LusienGG

[C#] Index of Letters

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