Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int n = int.Parse(Console.ReadLine());
- string result = String.Empty;
- bool normalSpin = true;
- string oldInput = String.Empty;
- for (int i = 0; i < n; i++)
- {
- string input = Console.ReadLine();
- if (normalSpin)
- {
- if (input != "spin")
- {
- if (input != oldInput) { oldInput = input; result += input; }
- else result = String.Empty;
- }
- else { oldInput = input; normalSpin = false; i--; }
- }
- else
- {
- if (input != "spin")
- {
- if (input != oldInput) { oldInput = input; result = input + result; }
- else result = String.Empty;
- }
- else { oldInput = input; normalSpin = true; i--; }
- }
- }
- Console.WriteLine(result);
Advertisement
Add Comment
Please, Sign In to add comment