Armstrong Number
Description
Given an integer N, determine whether it is an Armstrong number.
An Armstrong number (narcissistic number) is a number that equals the sum of its own digits each raised to the power of the number of digits.
Input Format
One integer N.
Output Format
Print YES if N is an Armstrong number, NO otherwise.
Constraints
1 <= N <= 1000000
Example
Input: 153
Output: YES
*(because 1³ + 5³ + 3³ = 1 + 125 + 27 = 153)*
Input: 9474
Output: YES
*(because 9⁴ + 4⁴ + 7⁴ + 4⁴ = 6561 + 256 + 2401 + 256 = 9474)*
Input: 123
Output: NO
*(because 1³ + 2³ + 3³ = 1 + 8 + 27 = 36 ≠ 123)*
Explanation
1. Count the number of digits → n
2. For each digit d, compute d^n
3. Sum all values
4. If sum == original number → YES, else NO