I wanted to write a program to check if string entered is a palidrome. I wrote a program but i get errors while compiling. Can anyone help me identify errors in the program.
#include<iostream>
#include<string>
int main(){
string input;bool flag=false;
cout<<"Enter String: ";
cin>>input;
cout<<"You Entered "<<input;
int length= input.size();
for (int j=0; j<=length;j++){
if ((input.at(j))==(input.at(length))){
length--;flag=true;
if (flag==false) break;
}
else {flag=false;break;}
}
if (flag==false) cout<<"Not A Palindrome";
else cout<<"Palindrome";
return 0;