#C4666. Happy Number Checker

    ID: 48229 Type: Default 1000ms 256MiB

Happy Number Checker

Happy Number Checker

Given a positive integer \(n\), determine whether it is a happy number.

A happy number is defined by the following process: starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number either equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers.

Your task is to implement a program that reads an integer from standard input and prints True if the number is happy and False otherwise.

For example:

  • Input: 7, Output: True
  • Input: 4, Output: False

inputFormat

The input consists of a single line containing one positive integer \(n\) \((1 \le n \le 10^9)\).

outputFormat

Output a single line: True if \(n\) is a happy number, otherwise False.

## sample
7
True

</p>