In this exercice, we say that a natural number with digits is narcissistic, when is equal to the sum of the -th power of its digits. For example, 153 and 1634 are narcissistic numbers, as and .
A sequence of natural numbers is insufferably narcissistic when all the elements in the sequence are narcissistic numbers.
Write a program which, given a non-empty sequence of natural numbers, indicates whether it is insufferably narcissitic or not.
Your program must include, implement and use a function
bool is_narcissistic (int n);
indicating whether a natural is narcissistic or not.
The input is formed by a non-empty sequence of natural numbers.
The program has to indicate whether the sequence is insufferably narcissitic.
Follow the format described in the examples. Your code should follow the style rules and include the appropriate comments.
Input
0 1 2 3 4 5 6 7 8 9
Output
SI
Input
73 153 173 351 370 371 407 704
Output
NO
Input
153 370 1634 8208 407 9474 92727 93084 6
Output
SI
Input
1634 4361 4749 8208 9474 8028
Output
NO