Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. string s,smax;
  8. char c;
  9.  
  10. s = "";
  11. bool flag = true;
  12. while(c != '.'){
  13. cin >> c;
  14. if (c != ' ' && c != '.'){
  15. s += c;
  16. }
  17. if (c == ' ' || c == '.'){
  18. for (int i = 0; i < s.size() / 2 + 1; ++i){
  19. if (s[i] != s[s.size() - i){
  20. flag = false;
  21. }
  22. }
  23.  
  24. if (flag){
  25. if (s.size() >= smax.size()){
  26. smax = s;
  27. }
  28. }
  29. s = "";
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement