fork(2) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Flamaster
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int x = Convert.ToInt16(Console.ReadLine());
  14. while(x > 0)
  15. {
  16. string y = Convert.ToString(Console.ReadLine());
  17. char[] array = y.ToCharArray();
  18. int l = 1;
  19. for (int i = 0; i < array.Length - 1; i++)
  20. {
  21. if (array[i] == array[i + 1]) { l++;}
  22. if (l <= 2) { Console.Write(array[i]); }
  23. if ((l == 2) && (array[i] != array[i + 1])) { l = 1; }
  24. if ((l >= 3) && (array[i] != array[i + 1])) { Console.Write(l); l = 1; }
  25. }
  26. x--;
  27. }
  28. Console.ReadKey();
  29. }
  30. }
  31. }
  32.  
Success #stdin #stdout 0.02s 29656KB
stdin
Standard input is empty
stdout
Standard output is empty