forked from abeaumont/competitive-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
a.dylan
17 lines (14 loc) · 833 Bytes
/
a.dylan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module: a
url: https://code.google.com/codejam/contest/1460488/dashboard#s=p0
define function line() => (line :: <string>) read-line(*standard-input*) end;
define function number() => (number :: <integer>) string-to-integer(line()) end;
define function do-case(i) => ()
let t = table('a' => 'y', 'b' => 'h', 'c' => 'e', 'd' => 's', 'e' => 'o',
'f' => 'c', 'g' => 'v', 'h' => 'x', 'i' => 'd', 'j' => 'u',
'k' => 'i', 'l' => 'g', 'm' => 'l', 'n' => 'b', 'o' => 'k',
'p' => 'r', 'q' => 'z', 'r' => 't', 's' => 'n', 't' => 'w',
'u' => 'j', 'v' => 'p', 'w' => 'f', 'x' => 'm', 'y' => 'a',
'z' => 'q', ' ' => ' ');
format-out("Case #%d: %s\n", i, map(method(x) t[x] end, line()))
end function do-case;
do(curry(do-case), range(from: 1, to: number()));