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