Advertisement
fbinnzhivko

09.03 Index of letters

May 30th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.40 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4.     static void Main()
  5.     {
  6.         string word = Console.ReadLine();
  7.         char[] arr = new char[26];
  8.         for (int i = 0; i < arr.Length; i++)
  9.         {
  10.             arr[i] = (char)(97 + i);
  11.         }
  12.         for (int i = 0; i < word.Length; i++)
  13.         {
  14.             Console.WriteLine(word[i] + " -> " + Array.IndexOf(arr, word[i]));
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement