fork download
  1. import com.sun.xml.internal.ws.util.StringUtils
  2.  
  3. def map = [A: "4", B: "6", E: "3", I: "1", L: "1", M: "(V)",
  4. N: "(\\)", O: "0", S: "5", T: "7", V: "\\/", W: "`//"]
  5.  
  6. System.in.eachLine {line ->
  7. def output = line.toUpperCase()
  8. def is1337 = map.values().find{line.contains(it)}
  9.  
  10. map.entrySet().each {
  11. def (match,swap) = is1337 ? [it.value,it.key] : [it.key,it.value]
  12. output = output.replace(match,swap)
  13. }
  14.  
  15. if(is1337) output = StringUtils.capitalize(output.toLowerCase())
  16. println "${line} -> ${output}"
  17. }
Success #stdin #stdout 0.96s 4456448KB
stdin
I am elite.
Da pain!
Eye need help!
3Y3 (\)33d j00 t0 g37 d4 d0c70r.
1 n33d m4 p1llz!
stdout
I am elite. -> 1 4(\/) 31173.
Da pain! -> D4 P41(\)!
Eye need help! -> 3Y3 (\)33D H31P!
3Y3 (\)33d j00 t0 g37 d4 d0c70r. -> Eye need joo to get da doctor.
1 n33d m4 p1llz! -> I need ma pillz!