Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace MultiverseCommunication
- {
- class MultiverseCommunication
- {
- static void Main()
- {
- string input = Console.ReadLine();
- Dictionary<string,decimal> dict = new Dictionary<string, decimal>();
- dict.Add("CHU",0);
- dict.Add("TEL",1);
- dict.Add("OFT",2);
- dict.Add("IVA",3);
- dict.Add("EMY",4);
- dict.Add("VNB",5);
- dict.Add("POQ",6);
- dict.Add("ERI",7);
- dict.Add("CAD",8);
- dict.Add("K-A",9);
- dict.Add("IIA",10);
- dict.Add("YLO",11);
- dict.Add("PLA",12);
- decimal result = 0M;
- for (decimal i = input.Length-3, k = 1; i >= 0; i-=3,k*=13)
- {
- char one = input[(int)i];
- char two = input[(int)i + 1];
- char three = input[(int)i + 2];
- string temp = one +""+ two +""+ three;
- if (dict.ContainsKey(temp))
- {
- result += k*dict[temp];
- }
- }
- Console.WriteLine(result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment