Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class MultiverseCommunication
- {
- static int Base = 13;
- static string[] alphabet = { "CHU", "TEL", "OFT", "IVA", "EMY", "VNB", "POQ", "ERI", "CAD", "K-A", "IIA", "YLO", "PLA" };
- static ulong GetPowerOf13(int exp)
- {
- ulong result = 1;
- for (int i = 1; i <= exp; i++)
- {
- result *= (ulong)Base;
- }
- return result;
- }
- static void Main()
- {
- string message = Console.ReadLine();
- ulong result = 0;
- int power = 0;
- for (int i = message.Length - 1 - 2; i >= 0; i -= 3)
- {
- string letter = message.Substring(i, 3);
- int digit = 0;
- for (int j = 0; j < alphabet.Length; j++)
- {
- if (letter == alphabet[j])
- {
- digit = j;
- break;
- }
- }
- result += (ulong)digit * GetPowerOf13(power);
- power++;
- }
- Console.WriteLine(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement