def compress(word):
    """
    This function takes a string as an argument and returns a new string
    such that each character is followed by its count, and any adjacent
    duplicate characters are removed.
    """
    result = ""
    if len(word) == 0:
        return result
    else:
        count = 1
        for i in range(1, len(word)):
            if word[i] is word[i-1]:
                count += 1
            else:
                result = result + word[i-1] + str(count)
                count = 1
    return result + word[len(word)-1] + str(count)