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 = { "Ow", "Aq", "Ta", "Sl", "Ph", "Ev", "Hf", "Gg", "dd", "Rn", "Km", "Wr", "Dp", "Ic", "yy", "jj",
  48. "Fs", "Ce", "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.04s 24628KB
stdin
qmnjvsa nv wewc flct vprj tj tvvplvl fv xja vqildhc
        xmlnvc nacyclpa fc gyt vfvw. fv wgqyp, pqq pqcs y wsq
        rx qmnjvafy cgv tlvhf cw tyl aeuq fv xja tkbv cqnsqs.
        lhf avawnc cv eas fuqb qvq tc yllrqr xxwa cfy. psdc uqf
        avrqc gefq pyat trac xwv taa wwd dv eas flcbq. vd trawm
        vupq quw x decgqcwt, yq yafl vlqs yqklhq! snafq vml
        lhvqpawr nqg_vfusr_ec_wawy qp fn wgawdgf
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
jREAKER OF THIS CODE WItt jE jtESSED jx THE SidEAKx
        SPIRIT RESIDIyG Iy THE HOtE. GO AHEAD, AyD FIyD A WAx
        OF jREAKIyG THE SPEtt Oy HIu CAST jx THE EbIt kAFFAR.
        THE SPIRIT OF THE CAbE uAy IS AtWAxS WITH xOd. FIyD THE
        uAGIC WAyD THAT WItt tET xOd OdT OF THE CAbES. IT WOdtD
        uAKE xOd A uAGICIAy, yO tESS THAy kAFFAR! SPEAK THE
        PASSWORD THE_uAGIC_OF_WAyD TO GO THR