P27080 [AtCoder] Receipt
省选
题目描述

Problem Description

Taro went shopping and spent $A$ yen. Taro can pay any amount $X$ such that $X \geq A$. For the three integers representing the shopping amount $A$, the payment amount $X$, and the change $(X-A)$, Taro wants to maximize the number of matching digits when expressed in base 10.

For example, when $A=1980$ and $X=2970$, the hundreds place and the ones place match.

  A = 1980
  X = 2970
X-A =  990

Also, when $A=1080$ and $X=1080$, only the ones place matches. For the tens to thousands places, since $X-A$ does not have a digit in those places, they are considered not matching.

  A = 1080
  X = 1080
X-A =    0

Given $A$, find the maximum number of matching digits Taro can achieve.

Input Format

The input is given from the standard input in the following format:

$ A $

  • The first line contains an integer $A(1 \leq A \leq 10^{100})$.

Output Format

Output the maximum number of matching digits Taro can achieve in one line. End the output with a newline.

Sample Input and Output

Sample Input #1

1980

Sample Output #1

2

Sample Input #2

1080

Sample Output #2

2

Sample Input #3

1234

Sample Output #3

0

Notes/Hints

Sample Explanation 1

This is the first case in the problem statement.

Sample Explanation 2

For example, if $X=2080$, the hundreds place and the ones place match, which is the maximum. Note that if $X=1080$, only the ones place matches, as in the second case of the problem statement.

Sample Explanation 3

No matter how Taro pays, he cannot match any digits.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1980
样例输出
2