Advertisement
bacco

Index of Letters

Jun 1st, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4.  
  5. namespace ndexofLetters
  6. {
  7.     class MainClass
  8.     {
  9.         public static void Main(string[] args)
  10.         {
  11.             char[] alphabet = new char[26];
  12.  
  13.             for (char i = 'a'; i <= 'z' ; i++)
  14.             {
  15.                 alphabet[i - 'a'] = i;
  16.             }
  17.  
  18.             string input = Console.ReadLine();
  19.             var inputArr = input.ToArray();
  20.  
  21.             for (int i = 0; i < inputArr.Length ; i++)
  22.             {
  23.                 for (int j = 0; j < alphabet.Length ; j++)
  24.                 {
  25.                     if (inputArr[i] == alphabet[j])
  26.                     {
  27.                         Console.WriteLine($"{alphabet[j]} -> {j}");
  28.                     }
  29.                 }
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement