fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Level3
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. string text = @"qmnjvsa nv wewc flct vprj tj tvvplvl fv xja vqildhc
  13. xmlnvc nacyclpa fc gyt vfvw. fv wgqyp, pqq pqcs y wsq
  14. rx qmnjvafy cgv tlvhf cw tyl aeuq fv xja tkbv cqnsqs.
  15. lhf avawnc cv eas fuqb qvq tc yllrqr xxwa cfy. psdc uqf
  16. avrqc gefq pyat trac xwv taa wwd dv eas flcbq. vd trawm
  17. vupq quw x decgqcwt, yq yafl vlqs yqklhq! snafq vml
  18. lhvqpawr nqg_vfusr_ec_wawy qp fn wgawdgf.";
  19.  
  20. // Permute, order 43512
  21. string permutedText = "";
  22. int charAt = 0;
  23. try
  24. {
  25. while (true)
  26. {
  27. char[] chars = new char[5];
  28. string[] interstitials = new string[5];
  29. for (int curIndex = 0; curIndex < 5; curIndex++)
  30. {
  31. if (Char.IsLetter(text[charAt]))
  32. {
  33. chars[curIndex] = text[charAt++];
  34. // Take all the non-letters with it too
  35. while (!Char.IsLetter(text[charAt]))
  36. interstitials[curIndex] += text[charAt++];
  37. }
  38. }
  39. // Now concatenate
  40. permutedText += chars[3] + interstitials[0] + chars[2] + interstitials[1] +
  41. chars[4] + interstitials[2] + chars[0] + interstitials[3] + chars[1] + interstitials[4];
  42. }
  43. }
  44. catch (Exception) { }
  45.  
  46. text = permutedText;
  47. string[] rules = { "ww", "Aq", "Ta", "Sl", "Ph", "Ev", "Hf", "gg", "dd", "nn", "mm", "rr", "pp", "cc", "yy", "jj",
  48. "ss", "ee", "tt", "xx", "ii", "uu", "kk", "bb", };
  49.  
  50.  
  51. foreach (string i in rules)
  52. {
  53. Console.WriteLine("***" + i[1]);
  54. text = text.Replace("" + i[1], "" + i[0]);
  55. }
  56.  
  57. // Print
  58. int pos = 0;
  59. foreach (char c in text)
  60. {
  61. if (!Char.IsLetter(c))
  62. {
  63. Console.Write(c);
  64. continue;
  65. }
  66. Console.Write(c);
  67. pos++;
  68. if (pos == 5)
  69. {
  70. pos = 0;
  71. //Console.Write("|");
  72. }
  73. }
  74. }
  75. }
  76. }
Success #stdin #stdout 0.03s 26664KB
stdin
Standard input is empty
stdout
***w
***q
***a
***l
***h
***v
***f
***g
***d
***n
***m
***r
***p
***c
***y
***j
***s
***e
***t
***x
***i
***u
***k
***b
jnEAmEn ws THcS ewpE rctt jE jtESSEp jx THE SidEAmx
        SPcncT nEScpcyg cy THE HwtE. gw AHEAp, Ayp scyp A rAx
        ws jnEAmcyg THE SPEtt wy Hcu eAST jx THE Ebct kAssAn.
        THE SPcncT ws THE eAbE uAy cS AtrAxS rcTH xwd. scyp THE
        uAgce rAyp THAT rctt tET xwd wdT ws THE eAbES. cT rwdtp
        uAmE xwd A uAgcecAy, yw tESS THAy kAssAn! SPEAm THE
        PASSrwnp THE_uAgce_ws_rAyp Tw gw THn