simeon3000

Cypher Roulette 80/100

Jun 6th, 2017
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1.             int n = int.Parse(Console.ReadLine());
  2.             string result = String.Empty;
  3.             bool normalSpin = true;
  4.             string oldInput = String.Empty;
  5.  
  6.             for (int i = 0; i < n; i++)
  7.             {
  8.                 string input = Console.ReadLine();
  9.  
  10.                 if (normalSpin)
  11.                 {
  12.                     if (input != "spin")
  13.                     {
  14.                         if (input != oldInput) { oldInput = input; result += input; }
  15.                         else result = String.Empty;
  16.                     }
  17.                     else { oldInput = input; normalSpin = false; i--; }
  18.                 }
  19.  
  20.                 else
  21.                 {
  22.                     if (input != "spin")
  23.                     {
  24.                         if (input != oldInput) { oldInput = input; result = input + result; }
  25.                         else result = String.Empty;
  26.                     }
  27.                     else { oldInput = input; normalSpin = true; i--; }
  28.                 }
  29.             }
  30.  
  31.             Console.WriteLine(result);
Advertisement
Add Comment
Please, Sign In to add comment