Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace IzpitCsharp2
- {
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- class IzpitCsharp2
- {
- static void Main()
- {
- //grrrr miao miao
- string input = Console.ReadLine();
- List<string> catInput = input.Split(' ').ToList();
- var catCode = new List<string> { "a", "b", "c", "d", "e", "f", "g", "h", "i",
- "j", "k", "l", "m", "n", "o", "p", "q", "r", "s" };
- List<int> catNumber = new List<int>();
- string currentWord = string.Empty;
- int currentSum = 0;
- int sum = 0;
- for (int i = 0; i < catInput.Count; i++)
- {
- currentWord = catInput[i];
- currentSum = 0;
- for (int j = 0; j < currentWord.Length; j++)
- {
- if (catCode.Contains(currentWord[j].ToString()))
- {
- catNumber.Add(catCode.IndexOf(currentWord[j].ToString()));
- }
- }
- for (int n = 0; n < catNumber.Count; n++)
- {
- int digits = int.Parse((catNumber[n].ToString()));
- currentSum += digits * powerOfNine(catNumber.Count - n - 1);
- sum += currentSum;
- }
- }
- Console.WriteLine(sum);
- }
- static int powerOfNine(int power)
- {
- int result = 1;
- for (int i = 0; i < power; i++)
- {
- result *= 19;
- }
- return result;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement