#C5599. Detecting Smith Numbers
Detecting Smith Numbers
Detecting Smith Numbers
A Smith Number is a composite number for which the sum of its digits is equal to the sum of the digits of its prime factors (counted with multiplicity). Mathematically, let \(S(n)\) denote the sum of the digits of \(n\) and let \(F(n)\) denote the sum of the digits of all prime factors of \(n\). A number \(n\) (which is not prime) is called a Smith Number if:
[ S(n) = F(n) ]
Your task is to determine whether a given positive integer is a Smith Number. If the number is prime, it is not considered a Smith Number.
inputFormat
The input consists of a single line containing a positive integer \(n\) (1 \(\leq n \leq 10^9\)).
outputFormat
Output a single line: print Smith !!
if \(n\) is a Smith Number and Not !!
otherwise.
22
Smith !!