Advertisement
Guest User

Untitled

a guest
May 27th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. 1.
  2. #include <cstdlib>
  3. 2.
  4. #include <iostream>
  5. 3.
  6. #include <string>
  7. 4.
  8. using namespace std;
  9. 5.
  10.  
  11. 6.
  12. int main(int argc, char *argv[])
  13. 7.
  14. {
  15. 8.
  16. char* w = new char[100];
  17. 9.
  18. int t;
  19. 10.
  20. int cf, cb;
  21. 11.
  22. bool eq = true;
  23. 12.
  24. string s;
  25. 13.
  26. for(cin >> t, cin.getline(w, 100); t > 0; t--, eq = true)
  27. 14.
  28. {
  29. 15.
  30. w = new char[100];
  31. 16.
  32. cin.getline(w, 100);
  33. 17.
  34. s = w;
  35. 18.
  36. for(cf = 0, cb = s.size()-1; cf < cb; cf++, cb--)
  37. 19.
  38. {
  39. 20.
  40. if(s[cf] == ' ')
  41. 21.
  42. {
  43. 22.
  44. cf++;
  45. 23.
  46. continue;
  47. 24.
  48. }
  49. 25.
  50. if(s[cb] == ' ')
  51. 26.
  52. {
  53. 27.
  54. cb--;
  55. 28.
  56. continue;
  57. 29.
  58. }
  59. 30.
  60. if(s[cb] != s[cf]) eq = false;
  61. 31.
  62. }
  63. 32.
  64. if(eq == true) cout << "t";
  65. 33.
  66. else cout << "n";
  67. 34.
  68. if(t > 1) printf("\n", "");
  69. 35.
  70. }
  71. 36.
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement