Untitled
unknown
c_cpp
2 years ago
387 B
4
Indexable
#include <iostream> #include <string> using namespace std; int main() { string s = ""; char c; cin >> c; cin.ignore(); while (getline(cin, s)) { int count = 0; for (int i = 0; i < s.length(); i++) { if (tolower(c) == tolower(s[i])) { count++; } } cout << count << '\n'; } return 0; }
Editor is loading...