Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Text.RegularExpressions;
- class KaspichanNumbers2
- {
- static void Main()
- {
- string input = Console.ReadLine();
- Stack<string> num168 = new Stack<string>();
- foreach (Match number in Regex.Matches(input,"[a-z]?[A-Z]"))
- {
- num168.Push(number.Value);
- }
- long number10 = 0;
- int position = 0;
- while (num168.Count > 0)
- {
- string currStr = num168.Pop();
- if (currStr.Length == 1)
- {
- number10 += (currStr[0] - 'A') * (long)Math.Pow(168,position);
- }
- else
- {
- number10 += ((currStr[1] - 'A') + ((currStr[0] - 'a')+1)*26) * (long)Math.Pow(168, position);
- }
- position++;
- }
- Console.WriteLine(number10);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement