Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace _9GagNumbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- string gagnumber = Console.ReadLine();
- string[] gags = { "-!", "**", "!!!", "&&", "&-", "!-", "*!!!", "&*!", "!!**!-" };
- List<int> numbers = new List<int>();
- List<int> results = new List<int>();
- int count = 0;
- int result = 0;
- for (int i = 0; i < gags.Length; i++)
- {
- if (gags[i] == gagnumber)
- {
- Console.WriteLine(i);
- break;
- }
- else
- {
- if (i==gags.Length-1)
- {
- for (int k = 0; k <= gagnumber.Length - 1; k++)
- {
- for (int l = 1; l < gagnumber.Length - k + 1; l++)
- {
- for (int j = 0; j < gags.Length; j++)
- {
- if (gagnumber.Substring(k, l) == gags[j])
- {
- results.Add(j);
- k =k+gags[j].Length;
- l = 1;
- break;
- }
- }
- }
- }
- results.Reverse();
- for (int j=0; j <results.Count;j++)
- {
- result +=(results[j])*(int)Math.Pow(9,j);
- }
- Console.WriteLine(result);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement