fork download
  1. // D (compile time)
  2. // $ dmd -J`pwd` -o- A.d 2> out.txt
  3. import std.conv;
  4. import std.string;
  5.  
  6. string solveAll(string s)
  7. {
  8. return s.splitLines().solveEach(1);
  9. }
  10.  
  11. string solveEach(string[] lines, int i)
  12. {
  13. if( i == lines.length )
  14. return "";
  15. return text("Case #", i, ": ", solve(lines[i]), "\n", lines.solveEach(i+1));
  16. }
  17.  
  18. string constructTable(string before, string after)
  19. {
  20. char[char.max+1] map;
  21. foreach(ref c; map) c = '*';
  22.  
  23. foreach(i; 0..before.length)
  24. map[after[i]] = before[i];
  25. return text('"', map, '"');
  26. }
  27.  
  28. string solve(string s)
  29. {
  30. string t;
  31. foreach(c; s)
  32. t ~= mixin(constructTable(
  33. "
  34. our language is impossible to understand
  35. there are twenty six factorial possibilities
  36. so it is okay if you want to just give up
  37. a zooq
  38. ",
  39. "
  40. ejp mysljylc kd kxveddknmc re jsicpdrysi
  41. rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd
  42. de kr kd eoya kw aej tysr re ujdr lkgc jv
  43. y qeez
  44. " ))[c];
  45. return t;
  46. }
  47.  
  48. immutable inputFileName = "A.in";
  49.  
  50. version(RunTime)
  51. {
  52. import std.file, std.stdio;
  53. void main() { inputFileName.readText().solveAll().write(); }
  54. }
  55. else
  56. {
  57. pragma(msg, import(inputFileName).solveAll());
  58. }
  59.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty