#K15846. Happy Number Checker

    ID: 24447 Type: Default 1000ms 256MiB

Happy Number Checker

Happy Number Checker

Given an integer n, determine whether it is a happy number. A number is defined as happy if starting with the number and repeatedly replacing it by the sum of the squares of its digits eventually results in the number 1. Mathematically, if you define the operation by \( S(n) = \sum_{d \in D(n)} d^2 \), where \( D(n) \) represents the digits of \( n \), then n is happy if there exists a finite sequence such that \( S(\cdots S(n)\cdots)=1 \).

Your task is to write a program which reads an integer from standard input and prints True if it is a happy number, or False otherwise.

inputFormat

The input consists of a single line containing an integer n.

Example:

19

outputFormat

Print True if the given number is a happy number, otherwise print False. There should be no extra characters or spaces in the output.

Example:

True
## sample
19
True