Advertisement
Filip13

niska polindrom

Nov 3rd, 2022
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. string word;
  9. cin >> word;
  10. bool palindrom = false;
  11.  
  12. for (int i = 0, j = word.size() - 1; i < j; i++, j--) {
  13. if (word[i] != word[j]) {
  14. palindrom = false;
  15. break;
  16. }
  17.  
  18. else {
  19. palindrom = true;
  20. }
  21.  
  22. }
  23. if (palindrom == false) { cout << "ne"; }
  24. else { cout << "da"; }
  25.  
  26. return 0;
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement