fork(2) download
  1. using System;
  2.  
  3. class Test
  4. {
  5. static string[] n = {
  6. "ONE",
  7. "TWO",
  8. "THREE",
  9. "FOUR",
  10. "FIVE",
  11. "SIX",
  12. "SEVEN",
  13. "EIGHT",
  14. "NINE"
  15. };
  16. static string DeCrypt(string s)
  17. {
  18. string a = s, d = "";
  19. int x = 1, p, i;
  20. while (a != "")
  21. {
  22. a = s;
  23. d = "";
  24. for (i = x; i <= 9 && a!=""; i++)
  25. {
  26. foreach (char c in n[i - 1])
  27. {
  28. p = a.IndexOf(c);
  29. if (p >= 0)
  30. a = a.Remove(p, 1);
  31. else
  32. {
  33. a = "!";
  34. x++;
  35. break;
  36. }
  37. }
  38. if (a == "!")
  39. {
  40. break;
  41. }
  42. d += i;
  43. }
  44. }
  45. return d;
  46. }
  47. public static void Main()
  48. {
  49. Console.WriteLine(DeCrypt("WNTEOO"));
  50. Console.WriteLine(DeCrypt("HSISIIXEEGEEVNNNT"));
  51. }
  52. }
Success #stdin #stdout 0s 131840KB
stdin
Standard input is empty
stdout
12
6789