---
# System prepended metadata

title: 2325. Decode the Message

---

#  2325. Decode the Message


![](https://hackmd.io/_uploads/S1zlQPks5.png)


```python=
class Solution:
    def decodeMessage(self, key: str, message: str) -> str:
        az='abcdefghijklmnopqrstuvwxyz'
        d={' ': ' '}
        j=0
        for x in key:
            if x not in d:
                d[x]=az[j]  # if j==0, az[j] is 'a'
                j+=1
               
        return ''.join(d[x] for x in message)

```