fork download
  1. #include <iostream>
  2. using namespace std;
  3. class Solution {
  4. public:
  5. bool isPalindrome(string s) {
  6. int n=s.size();
  7. // Run the loop for the given problems
  8.  
  9. for(int i=0;i<n/2;i++){
  10. if(s[i]==' '){
  11. i++;
  12. }
  13.  
  14. if(s[i]!=s[n-i-1]){
  15. return "false";
  16. }
  17.  
  18. return "true";
  19. }
  20.  
  21. }
  22.  
  23.  
  24.  
  25. };
  26. int main() {
  27. // your code goes here
  28. Solution s1;
  29. bool palindrone1=s1.isPalindrome("Suman");
  30. cout<<palindrone1;
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0s 5304KB
stdin
Standard input is empty
stdout
1