Company: Trilogy_7aug
Difficulty: medium
Cryptarithm Problem Description A cryptarithm is a puzzle in which an addition is written with letters instead of digits. You are given three words word1 , word2 and word3 , which stand for the equation word1 + word2 = word3 A solution assigns a decimal digit ( 0 to 9 ) to every distinct letter that appears in the three words, such that: different letters get different digits, and every occurrence of the same letter gets the same digit; the leading digit of any word with more than one letter is not 0 (a one-letter word may be 0 ); after every letter is replaced by its digit, the three words read as decimal numbers and word1 + word2 = word3 holds. Count the number of different solutions. Two solutions are different if at least one letter gets a different digit. Input Format Read from standard input. word1 word2 word3 The input consists of three lines; line i contains the i -th word. (inferred -- the source passes the three words as a string array argument; one word per line is used here