Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <iostream>
- #include <algorithm>
- bool poli_test(std::string s){
- std::string buf = s;
- std::reverse(s.begin(), s.end());
- if (buf == s) return true;
- return false;
- }
- int main(){
- std::string s;
- std::getline(std::cin, s);
- s += ' ';
- int k = 0;
- while (true){
- while (s[0] == ' ') s.erase(0, 1);
- if (s.empty()) break;
- if (poli_test(s.substr(0, s.find(' ')))) k += 1;
- s.erase(0, s.find(' ') + 1);
- }
- std::cout << k;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement