Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - sing System;
- namespace _10.PalindromeIndex
- {
- using System.Linq;
- public class PalindromeIndex
- {
- public static void Main()
- {
- string word = Console.ReadLine().ToLower();
- string reversed = new string(word.Reverse().ToArray());
- if (word == reversed)
- {
- Console.WriteLine("-1");
- }
- else
- {
- foreach (var letter in word)
- {
- string tempWord = word.Remove(word.IndexOf(letter), 1);
- reversed = new string(tempWord.Reverse().ToArray());
- if (tempWord == reversed)
- {
- Console.WriteLine(word.IndexOf(letter));
- break;
- }
- }
- }
- }
- }
- }
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment                    
                 
                    