if i say i have two strings or character lists,

```
list1 = ["c","a","t"]
 list2 = ["d","o","g"]

```

and if i read a string using Input Output `"ct"` and pass it to the function,the function should return `"dg"`.

Please give me any idea about such a function.