Advertisement
IPetrov007

Cypher Roulette

Feb 1st, 2017
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 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 _17_CypherRoulette
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14.  
  15. string result = string.Empty;
  16. string lastStr = string.Empty;
  17.  
  18. bool addToEnd = true;
  19.  
  20. for (int i = 0; i < n; i++)
  21. {
  22. string str = Console.ReadLine();
  23.  
  24. if (str.Equals(lastStr))
  25. {
  26. result = string.Empty;
  27. continue;
  28. }
  29.  
  30. lastStr = str;
  31.  
  32. if (str.Equals("spin"))
  33. {
  34. addToEnd = !addToEnd;
  35. i--;
  36. }
  37. else if(addToEnd == true)
  38. {
  39. result += str;
  40. }
  41. else if(addToEnd == false)
  42. {
  43. result = str + result;
  44. }
  45. }
  46.  
  47. Console.WriteLine(result);
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement