import string

def read_file(file):
    with open(file, 'r', encoding='utf-8') as f:
        return f.read()

def solve():
    secret_word = input().strip()
    content = read_file('mayday.txt')

    upper_count = 0
    lower_count = 0
    digit_count = 0
    space_count = 0
    other_count = 0

    for char in content:
        if char.isupper():
            upper_count += 1
        elif char.islower():
            lower_count += 1
        elif char.isdigit():
            digit_count += 1
        elif char.isspace():
            space_count += 1
        else:
            other_count += 1

    print(f"{upper_count} {lower_count} {digit_count} {space_count} {other_count}")

    temp_content = ""
    for char in content:
        if char in string.punctuation:
            temp_content += " "
        else:
            temp_content += char
    words = temp_content.split()
    print(f"共有{len(words)}单词")

    offset = sum(ord(c) for c in secret_word) % 26
    print(offset)

    encrypted_text = ""
    for char in content:
        if 'A' <= char <= 'Z':
            encrypted_text += chr((ord(char) - ord('A') + offset) % 26 + ord('A'))
        elif 'a' <= char <= 'z':
            encrypted_text += chr((ord(char) - ord('a') + offset) % 26 + ord('a'))
        else:
            encrypted_text += char
    print(encrypted_text)

if __name__ == "__main__":
    solve()