Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- const int XL = 50;
- int main()
- {
- int n;
- char a [XL];
- char b [XL];
- char c [XL];
- char d [XL];
- char e [XL];
- cin >> a;
- n = strlen(a);
- if (n<=3)
- {
- cout << n;
- return 0;
- }
- if (n%2 == 0)
- {
- for(int j = 0; j < n-1; j++)
- {
- if (a[j+1] != a[n-1-j] )
- {
- cout << n-1-j;
- return 0;
- }
- }
- }
- if (n%2 != 0)
- {
- for(int j = 0; j < n-1; j++)
- {
- if (a[j+1] != a[n-1-j] )
- {
- cout << n-1-j;
- return 0;
- }
- }
- }
- cout << 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement