whitestarrr

06. Index of letters

Jan 31st, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace IndexOfLetter
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int[] alphabet = new int[26];
  14. string input = Console.ReadLine();
  15. for (int i = 0; i < alphabet.Length; i++)
  16. {
  17. alphabet[i] = 97 + i;
  18. }
  19. for (int i = 0; i < input.Length; i++)
  20. {
  21. for (int j = 0; j < alphabet.Length; j++)
  22. {
  23. if (alphabet[j] == input[i])
  24. {
  25. Console.WriteLine("{0} -> {1}", input[i], j);
  26. }
  27. }
  28. }
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment