#C4869. Digit Root Palindrome

    ID: 48454 Type: Default 1000ms 256MiB

Digit Root Palindrome

Digit Root Palindrome

You are given a sequence of non-negative integers. For each integer (until a termination token 0 is encountered), compute its digit root and then check if that digit root is a palindrome.

The digit root of a number \( n \) is the iterative process of summing its digits until a single digit is obtained. Formally, if \( n \) is a non-negative integer, the digit root \( dr(n) \) is defined as:

\( dr(n) = \begin{cases} n, & \text{if } n < 10 \\ dr(\sum_{d \in digits(n)} d), & \text{if } n \geq 10 \end{cases} \)

A number is a palindrome if it reads the same backward as forward. Note that any single digit number is trivially a palindrome.

Your task is to process the input numbers until a 0 is encountered and for each number before the termination token, output Yes if its digit root is a palindrome, or No otherwise.

inputFormat

The input is given via stdin and consists of a sequence of non-negative integers separated by spaces or newlines. The sequence is terminated by the integer 0 which should not be processed.

outputFormat

Print the result for each processed number in a new line. For each integer, output Yes if its digit root is a palindrome, and No otherwise.

## sample
56 1234 98765 1010101 0
Yes

Yes Yes Yes

</p>