Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace NineGagNumbers
- {
- public class NineGagNumbers
- {
- private static readonly List<String> NumeralSystemDigits = new List<string> { "-!", "**", "!!!", "&&", "&-", "!-", "*!!!", "&*!", "!!**!-" };
- private const int NumeralSystemBase = 9;
- public static void Main()
- {
- string input = Console.ReadLine();
- var in9th = Convert9GagTo9th(input);
- }
- /// <summary>
- /// Converts a number from 9Gag numeral system to 9th numeral system
- /// </summary>
- /// <param name="nineGagNumber">A string in 9Gag numeral system</param>
- /// <returns>Returns a list of digits in numeral system with base 9</returns>
- private static List<int> Convert9GagTo9th(string nineGagNumber)
- {
- var result = new List<int>();
- StringBuilder currentDigit = new StringBuilder();
- for (int i = 0; i < nineGagNumber.Length; i++)
- {
- currentDigit.Append(nineGagNumber[i]);
- if (NumeralSystemDigits.Contains(currentDigit.ToString()))
- {
- int index = NumeralSystemDigits.IndexOf(currentDigit.ToString());
- result.Add(index);
- currentDigit.Clear();
- }
- }
- return result;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement