Advertisement
Guest User

Untitled

a guest
Dec 20th, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. class Program
  2.     {
  3.         static void Main(string[] args)
  4.         {
  5.             char[] lettersArray = new char[2 * 26];
  6.             for (int i = 0; i < 26; i++) // Create array from upper and lower characters
  7.             {
  8.                 char uppperChar = (char) ('A' + i);
  9.                 char lowerChar = (char)('a' + i);
  10.                 lettersArray[i] = uppperChar;
  11.                 lettersArray[26 + i] = lowerChar;
  12.             }
  13.  
  14.             string word = Console.ReadLine(); // Input
  15.  
  16.             for (int i = 0; i < word.Length; i++)
  17.             {
  18.                 int indexOfCurrentCharacter = Array.IndexOf(lettersArray, word[i]);
  19.                 Console.WriteLine(word[i] + " at position " +indexOfCurrentCharacter);
  20.             }
  21.         }
  22.  
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement