Problem 840
Check if Word Equals Summation of Two Words
Problem
The letters a to j stand for the digits 0 to 9 (a = 0, b = 1, ..., j = 9). The numerical value of a word is the number formed by its letters' digits, so acb is 021, which is 21. Given three words, decide whether the value of the first word plus the value of the second word equals the value of the third word. Convert each word digit by digit with value = value × 10 + digit.
Input
Three lines, each containing one word made of the letters a to j.
Output
Print YES if value(first) + value(second) = value(third), otherwise NO.
Constraints
1 <= |word| <= 8
Example input
acb cba cdb
Example output
YES
Explanation
acb is 21, cba is 210 and cdb is 231. Since 21 + 210 = 231, the answer is YES.