Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. char s[256];
  9. int i = 0;
  10. cin.getline(s, 256);
  11. int a,b,f;
  12. f = 1;
  13. a = 0;
  14. b = strlen(s) - 1;
  15. while ( a < b ){
  16. while (s[b] == ' ' ){
  17. b = b - 1;
  18. }
  19. while (s[a] == ' '){
  20. a = a + 1;
  21. }
  22. if ( s[a] != s[b] ){
  23. f = 0;
  24. cout << a << " " << b << endl;
  25. }
  26. a = a + 1;
  27. b = b - 1;
  28. }
  29. if ( f == 1){
  30. cout << "yes";
  31. }else
  32. cout << "no";
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement