Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <iostream>
  2.  
  3.  
  4. int main() {
  5. std::string s = "";
  6. char c, l;
  7. int n, k = 0;
  8. std::cin >> n;
  9. while (n != 0) {
  10. std::cin >> l;
  11. s += l;
  12. if (l != ' ') {
  13. --n;
  14. }
  15. }
  16.  
  17. std::cin >> c;
  18. for (int i = 0; i < s.size(); ++i) {
  19. if (s[i] == c) {
  20. ++k;
  21. }
  22. }
  23. std::cout << k;
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement