class Test205 { class Solution { fun isIsomorphic(s: String, t: String): Boolean { val f = mutableMapOf() val fp = mutableMapOf() for (i in s.indices){ if (f.containsKey(s[i]) || fp.containsKey(t[i])){ if (t[i] != f[s[i]] || s[i] != fp[t[i]]){ return false } }else{ f[s[i]] = t[i] fp[t[i]] = s[i] } } return true } } fun test(){ println(Solution().isIsomorphic("badc","baba")) } }