Letter value

Added: 2025-09-13 05:11:04

Question Image

Letter value

Answer

✏️ Edit
def get_numerical_value(word):
    result = ""
    for char in word:
        result += str(ord(char) - ord('a'))
    return int(result)

def is_sum_equal(first_word, second_word, target_word):
    first_val = get_numerical_value(first_word)
    second_val = get_numerical_value(second_word)
    target_val = get_numerical_value(target_word)
    
    return first_val + second_val == target_val

first_word = input().strip()
second_word = input().strip()
target_word = input().strip()

result = is_sum_equal(first_word, second_word, target_word)
print("true" if result else "false")