1
2
3
tr={f,t,w->w.collect{f.contains(it)?t[f.indexOf(it)]:it}.join()}

println(tr("qwertyuiop","QWERTYUIOP","typewriter"))