Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Exc._9.Index_of_Letters
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- char[] arrinput = input.ToCharArray();
- for (int i = 0; i < arrinput.Length; i++) //purvo re6enie
- {
- Console.WriteLine(arrinput[i] + " -> " +((int)(arrinput[i]) - 97));
- }
- return;
- var alphabet = new char[26]; //vtoro reshenie
- int count=0;
- for (char i = 'a'; i < 'z'+1; i++)
- {
- alphabet[count] = i;
- count++;
- }
- for (int i = 0; i < arrinput.Length; i++)
- {
- for (int i2 = 0; i2 < alphabet.Length; i2++)
- {
- if (arrinput[i] == alphabet[i2])
- {
- Console.WriteLine(arrinput[i] + " -> " + ((int)(arrinput[i])-97));
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement