spacerose

поиск символа в строке

Dec 18th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int i = 0, count = 0;
  8.     string s;
  9.     getline(cin, s);
  10.     while (s[i] != '\0')
  11.     {
  12.         if (s[i] == 'K' || s[i] == 'c') count++;
  13.         i++;
  14.     }
  15.     cout << count << endl;
  16. }
Add Comment
Please, Sign In to add comment