The letter value of a letter is its position in the alphabet starting from 0 (i.e. 'a' -&gt; 0, 'b' -&gt; 1, 'c' -&gt; 2, etc.).

The numerical value of some string of lowercase English letters s is the concatenation of the letter values of each letter in s, which is then converted into an integer.


	For example, if s = "acb", we concatenate each letter's letter value, resulting in "021". After converting it, we get 21.


You are given three strings firstWord, secondWord, and targetWord, each consisting of lowercase English letters 'a' through 'j' inclusive.

Return true if the summation of the numerical values of firstWord and secondWord equals the numerical value of targetWord, or false otherwise.

&nbsp;
Example 1:

Input: firstWord = "acb", secondWord = "cba", targetWord = "cdb"
Output: true
Explanation:
The numerical value of firstWord is "acb" -&gt; "021" -&gt; 21.
The numerical value of secondWord is "cba" -&gt; "210" -&gt; 210.
The numerical value of targetWord is "cdb" -&gt; "231" -&gt; 231.
We return true because 21 + 210 == 231.


Example 2:

Input: firstWord = "aaa", secondWord = "a", targetWord = "aab"
Output: false
Explanation: 
The numerical value of firstWord is "aaa" -&gt; "000" -&gt; 0.
The numerical value of secondWord is "a" -&gt; "0" -&gt; 0.
The numerical value of targetWord is "aab" -&gt; "001" -&gt; 1.
We return false because 0 + 0 != 1.


Example 3:

Input: firstWord = "aaa", secondWord = "a", targetWord = "aaaa"
Output: true
Explanation: 
The numerical value of firstWord is "aaa" -&gt; "000" -&gt; 0.
The numerical value of secondWord is "a" -&gt; "0" -&gt; 0.
The numerical value of targetWord is "aaaa" -&gt; "0000" -&gt; 0.
We return true because 0 + 0 == 0.


&nbsp;
Constraints:


	1 &lt;= firstWord.length, secondWord.length, targetWord.length &lt;= 8
	firstWord, secondWord, and targetWord consist of lowercase English letters from 'a' to 'j' inclusive.


class Solution:
    def isSumEqual(self, firstWord: str, secondWord: str, targetWord: str) -> bool:
        x=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
        a=""
        for i in firstWord:
            a=a+str(x.index(i))
        
        b=""
        for i in secondWord:
            b=b+str(x.index(i))

        c=""
        for i in targetWord:
            c=c+str(x.index(i))
        if int(a)+int(b)==int(c):
            return True
        return False
class Solution {
    public boolean isSumEqual(String firstWord, String secondWord, String targetWord) {
        int sumfirst=0, sumsecond=0, sumtarget=0;
        for(char c : firstWord.toCharArray()){
            sumfirst += c-'a';
            sumfirst *= 10;
        }
        for(char c : secondWord.toCharArray()){
            sumsecond += c-'a';
            sumsecond *= 10;
        }
        for(char c : targetWord.toCharArray()){
            sumtarget += c-'a';
            sumtarget *= 10;
        }
       
        return (sumfirst + sumsecond) == sumtarget;
    }
}
class Solution {
public:
    bool isSumEqual(string firstWord, string secondWord, string targetWord) {
        int first=0,second=0,target=0;
        for(int i=0;i<firstWord.size();i++)
            first=first*10 + (firstWord[i]-'a');
        
        for(int i=0;i<secondWord.size();i++)
            second=second*10 +(secondWord[i]-'a');
        
        for(int i=0;i<targetWord.size();i++)
            target=target*10 +(targetWord[i]-'a');
        
        
        return first+second == target;
    }
};
var isSumEqual = function(firstWord, secondWord, targetWord) {
    let obj = {
        'a' : '0',
        "b" : '1',
        "c" : '2',
        "d" : '3',
        "e" : '4',
        'f' : '5',
        'g' : '6',
        'h' : '7',
        'i' : '8', 
        "j" : '9'
    }
    let first = "", second = "", target = ""
    for(let char of firstWord){
        first += obj[char]
    }
    for(let char of secondWord){
        second += obj[char]
    }
    for(let char of targetWord){
        target += obj[char]
    }
    return parseInt(first) + parseInt(second) === parseInt(target)
};
Check if Word Equals Summation of Two Words