2325. Decode the Message

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 2325

class Solution:
    def decodeMessage(self, key: str, message: str) -> str:
        d = {" ": " "}
        i = 0
        for c in key:
            if c not in d:
                d[c] = ascii_lowercase[i]
                i += 1
        return "".join(d[c] for c in message)