cho.sh
Notes
Loading...

Addition Cycle

Time limit

2s

Memory limit

128 MB

Problem

You are given an integer N between 0 and 99, inclusive. Repeatedly make a new number with the following operation.

  1. If the current number has one digit, treat it as a two-digit number by adding a leading 0.
  2. Add the two digits.
  3. Concatenate the rightmost digit of the current number with the rightmost digit of that sum to form the next number.

The cycle length of N is the number of operations needed until the original number N appears again. Given N, write a program that computes its cycle length.

Input

The first line contains an integer N. N is between 0 and 99, inclusive.

Output

Print the cycle length of N on the first line.