Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.IO;
- using System;
- class Program
- {
- static void Main()
- {
- string s = Console.ReadLine();
- int n = 0;
- int m = s.Length - 1;
- bool polindrom = true;
- bool have = false;
- while (n <= m)
- {
- if (s[n] != s[m])
- {
- polindrom = false;
- }
- if (s[m] != s[0] || s[n] != s[0])
- {
- have = true;
- }
- n += 1;
- m -= 1;
- }
- if (!have)
- {
- Console.WriteLine(-1);
- }
- else
- {
- if (polindrom)
- {
- Console.WriteLine(s.Length-1);
- }
- else
- {
- Console.WriteLine(s.Length);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement