#C3059. Happy Number Checker

    ID: 46444 Type: Default 1000ms 256MiB

Happy Number Checker

Happy Number Checker

Determine if a given positive integer is a Happy Number.

A number \(n\) is considered happy if the sequence defined by \[ n, \; S(n)=\sum_{i=1}^{k}\text{digit}_i^2, \; S(S(n)), \; \ldots \] easily reaches 1. If it enters a cycle that does not include 1, then \(n\) is an unhappy number.

Your task is to write a program that reads an integer from standard input and outputs "True" if the number is happy, or "False" otherwise.

inputFormat

The input consists of a single line containing an integer (n) (e.g., 1 (\leq n \leq) 109). Read the input from standard input (stdin).

outputFormat

Output a single line: "True" if (n) is a Happy Number, otherwise output "False", printed to standard output (stdout).## sample

19
True

</p>