Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Practice_
- {
- class Program
- {
- static void Main(string[] args)
- {
- var n = int.Parse(Console.ReadLine());
- string cypher = ""; var previousStr = "";
- for (int i = 1; i <= n; i++)
- {
- var str = Console.ReadLine();
- if (str != "spin")
- {
- cypher += str;
- if (previousStr == str) cypher = "";
- previousStr = str;
- }
- else if (str == "spin")
- {
- if (str == "spin" && previousStr == "spin") cypher = "";
- previousStr = str;
- for (int a = 1; a <= n; i++)
- {
- str = Console.ReadLine();
- if (str == "spin" && previousStr == str) cypher = "";
- if (str == "spin")
- {
- i--; previousStr = str; break;
- }
- cypher = str + cypher;
- if (previousStr == str) cypher = "";
- previousStr = str;
- if (i >= n)
- {
- Console.WriteLine(cypher);
- return;
- }
- }
- }
- }
- Console.WriteLine(cypher);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement