代码(首刷自解 2024年10月16日)
#include <iostream>
using namespace std;int main() {string input;getline(cin, input);char target;cin >> target;char t2;if (target >= 'a' && target <= 'z') {t2 = target + ('A' - 'a');} else if (target >= 'A' && target <= 'Z') {t2 = target + ('a' - 'A');}int count = 0;for (auto x : input) {if (x == target || x == t2) {count++;}}cout << count << endl;return 0;
}
// 64 位输出请用 printf("%lld")