Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- class C
- {
- static void Main()
- {
- string input = Console.ReadLine();
- if (IsPalindrome(input))
- {
- Console.WriteLine(-1);
- }
- else
- {
- for (int i = 0; i < input.Length; i++)
- {
- string a = input.Remove(i, 1);
- var b = a.Reverse();
- if (a == (string)b)
- {
- Console.WriteLine(i);
- }
- }
- }
- }
- static bool IsPalindrome(string word)
- {
- for (int i = 0; i < word.Length / 2; i++)
- {
- if (word[i] != word[word.Length - 1 - i]) return false;
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement