Check if Word Equals Summation of Two Words LeetCode solution in Python
1# Runtime: 40 ms (Top 58.1%) | Memory: 16.21 MB (Top 73.9%)234class Solution:5def isSumEqual(self, firstWord: str, secondWord: str, targetWord: str) -> bool:6x = [7"a",8"b",9"c",10"d",11"e",12"f",13"g",14"h",15"i",16"j",17"k",18"l",19"m",20"n",21"o",22"p",23"q",24"r",25"s",26"t",27"u",28"v",29"w",30"x",31"y",32"z",33]34a = ""35for i in firstWord:36a = a + str(x.index(i))3738b = ""39for i in secondWord:40b = b + str(x.index(i))4142c = ""43for i in targetWord:44c = c + str(x.index(i))45if int(a) + int(b) == int(c):46return True47return False