def check(word: str, guess: str):
    """Checks the given guess agains the guessable word
        returns a (pattern, wrongplace, unused) tuple where
        pattern is in the form '??es?' showing the right letters
        wrongplace is a list of 5 strings, one for each position, containing the letters
          that are right but not for that position. e.g. ['ah','','a','','']
        unused is a set containing letters that we now now, do not appear in the word.
    """
    pattern = ""
    wrongplace = ["", "", "", "", ""]
    unused = set()
    for i in range(len(word)):
        if guess[i] == word[i]:
            pattern += word[i]
        else:
            if word.count(guess[i]):
                wrongplace[i] = wrongplace[i] + guess[i]
            else:
                unused.add(guess[i])
            pattern += "?"
    return pattern, wrongplace, unused