Company: Trilogy_8aug
Difficulty: medium
Cryptarithmetic Puzzle Problem Description A cryptarithm is an addition puzzle written with letters instead of digits. You are given three words word1 , word2 and word3 , which stand for the sum word1 + word2 ------- word3 An assignment gives each distinct letter a decimal digit ( 0 to 9 ). An assignment is a valid solution when all of these hold: Different letters get different digits, and every occurrence of the same letter gets the same digit. No word of two or more letters starts with the digit 0 . A word of exactly one letter may be 0 . Replacing every letter by its digit turns the three words into numbers with word1 + word2 = word3 . Implement the function solution(crypt) , where crypt = [word1, word2, word3] , and return the number of valid solutions . Input Format Read from standard input. word1 word2 word3 A single line contains the three words, separated by single spaces. (inferred -- the source passes crypt to a function; this is the stdin form used here.) Output Format Prin