Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _17.CypherRoulette
- {
- public class CypherRoulette
- {
- public static void Main(string[] args)
- {
- int numberInputs = int.Parse(Console.ReadLine());
- string newWord = "";
- string prevWord = "";
- string finalString = "";
- int appendDirection = 0;
- for (int i = 0; i < numberInputs; i++)
- {
- newWord = Console.ReadLine();
- if (newWord == "spin") {
- if (appendDirection == 0) {
- appendDirection++;
- numberInputs++;
- continue;
- }
- }
- if (newWord == "spin") {
- if (appendDirection == 1)
- {
- appendDirection--;
- numberInputs++;
- continue;
- }
- }
- if (i != 0)
- {
- if (prevWord == newWord)
- {
- finalString = "";
- continue;
- }
- }
- if (appendDirection == 0)
- {
- finalString = finalString + newWord;
- prevWord = newWord;
- }
- if (appendDirection == 1)
- {
- finalString = newWord + finalString;
- prevWord = newWord;
- }
- }
- Console.WriteLine(finalString);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment