Created
April 22, 2015 20:17
-
-
Save jonatasemidio/bdc3d3e7743cb43645be to your computer and use it in GitHub Desktop.
Problem A. Speaking in Tongues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d=[:];n='';r='' | |
g = 'ejp mysljylc kd kxveddknmc re jsicpdrysi rbcpc\nypc rtcsra dkh wyfrepkym veddknkmkrkcd\nde kr kd eoya kw aej tysr re ujdr lkgc jvqz' | |
e = 'our language is impossible to understand there\nare twenty six factorial possibilities\nso it is okay if you want to just give upzq' | |
g.eachWithIndex{s,i->d+=["${s}":e[i]]} | |
def tc(def s){d.find{it.key==s}.value} | |
def tl(def l){l.each{n += tc(it)};return n} | |
g.split('\\n').eachWithIndex{s,i->r+="Case #${i+1}: ${tl(s)}\n"} | |
r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment