Telephone Keypad Letter Mapping Fixed by croyal

System.in.withReader{
 w=it.readLine().split('0')
 w.each{
  t=''
  l=it.split('1')
  l.each{
   if(it!=''){
    s=0
    c=it.substring(0,1).toInteger()
    if(c>7){s=1}
    t+=(char)(c*3+90+it.length()+s)
   }
  }
  print"$t "
 }
}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page