Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace ConsoleTests
- {
- class ConsoleTests
- {
- static void Main()
- {
- Dictionary<string, decimal> dictionary =
- new Dictionary<string, decimal>();
- string[] phrases = new string[]
- {
- "Rawr","Rrrr","Hsst","Ssst","Grrr","Rarr","Mrrr","Psst","Uaah",
- "Uaha","Zzzz","Bauu","Djav","Myau","Gruh"
- };
- for (int i = 0; i < 15; i++)
- {
- dictionary.Add(phrases[i],i);
- }
- string input = Console.ReadLine();
- List<string> collection = new List<string>();
- int chunkSize = 4;
- int stringLength = input.Length;
- for (int i = 0; i < stringLength; i += chunkSize)
- {
- if (i + chunkSize > stringLength) chunkSize = stringLength - i;
- collection.Add(input.Substring(i, chunkSize));
- }
- collection.Reverse();
- List<decimal> results = new List<decimal>();
- for (decimal i = 0, j = 1; i < collection.Count; i++,j*=15)
- {
- string temp = collection[Convert.ToInt32(i)];
- if (dictionary.ContainsKey(temp))
- {
- decimal tempDigit = dictionary[temp];
- results.Add(tempDigit*j);
- }
- }
- Console.WriteLine(results.Sum());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment