groovy
Posted: Thu Apr 10, 2014 4:26 pm
Code: Select all
def dic = [
'A' : 'is',
'B' : 'mm',
'C' : 'oo',
'D' : 'rgr',
'E' : 'ryg',
'F' : 'dth',
'G' : 'you',
'H' : 'esol',
'I' : 'ionA',
'J' : 'GDaBarA',
'K' : 'veECFHutI',
'L' : 'PQ',
'M' : 'n',
'N' : 'm',
'O' : 'oaNcho',
'P' : 'MO',
'Q' : 'NR',
'R' : 'sky',
'S' : 'JKL']
def text = 'S'
while(text.any{dic[it]}) {
def replacement = ''
text.each {replacement += dic[it]?:it}
text = replacement
}
println text