Advertisement
Guest User

**Cypher Roulete

a guest
Mar 30th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Practice_
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             var n = int.Parse(Console.ReadLine());
  15.             string cypher = ""; var previousStr = "";
  16.  
  17.             for (int i = 1; i <= n; i++)
  18.             {
  19.  
  20.                 var str = Console.ReadLine();
  21.  
  22.                 if (str != "spin")
  23.                 {
  24.                     cypher += str;
  25.                     if (previousStr == str) cypher = "";
  26.                     previousStr = str;                  
  27.  
  28.                 }
  29.                 else if (str == "spin")
  30.                 {
  31.                     if (str == "spin" && previousStr == "spin") cypher = "";
  32.                     previousStr = str;
  33.                     for (int a = 1; a <= n; i++)
  34.                     {
  35.                        
  36.                         str = Console.ReadLine();
  37.                         if (str == "spin" && previousStr == str) cypher = "";
  38.                         if (str == "spin")
  39.                         {
  40.                             i--;   previousStr = str; break;
  41.                         }
  42.  
  43.                         cypher = str + cypher;
  44.                         if (previousStr == str) cypher = "";
  45.                         previousStr = str;
  46.                        
  47.                         if (i >= n)
  48.                         {
  49.                             Console.WriteLine(cypher);
  50.                             return;
  51.                         }
  52.                     }
  53.  
  54.  
  55.                 }
  56.             }
  57.             Console.WriteLine(cypher);
  58.         }
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement