Advertisement
valkata

Cypher Roulette

Jun 7th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace cypherRoulette
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             string phrase = "";
  15.             string word1 = "";
  16.             string word2 = "";
  17.             int spin = 0;
  18.              
  19.  
  20.             for (int i = 0; i < n; i++)
  21.             {
  22.                 word1 = "";
  23.  
  24.                 string word = Console.ReadLine();
  25.                 word1 = word;
  26.                 if (word.Equals("spin"))
  27.                 {
  28.                     spin += 1;
  29.                     word = "";
  30.                     i -= 1;
  31.                 }
  32.                 if (spin % 2 == 0)
  33.                 {
  34.                     phrase = phrase + word;
  35.                 }
  36.                 else
  37.                 {
  38.                     phrase = word + phrase;
  39.                 }
  40.                 if (word1.Equals(word2))
  41.                 {
  42.                     phrase = "";
  43.                 }
  44.                
  45.                 word2 = word1;
  46.             }
  47.             Console.WriteLine(phrase);
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement