#P5690. [CSP-S 2019 江西] 日期

[CSP-S 2019 江西] 日期

Description

Alice wrote a date on paper in the form MM-DD\text{MM-DD}, where MM\text{MM} and DD\text{DD} are both two-digit numbers representing the month and the day, respectively. However, this date may not actually exist. Alice asked Bob to change the digits in some positions so that the date becomes valid. Please help Bob compute the minimum number of digits he needs to change.

In this problem, February is fixed to have 2828 days.

Input Format

A single line containing a string of five characters, representing MM-DD\text{MM-DD}.

Output Format

A single line containing one integer, representing the answer.

03-32
1
02-39
1
67-89
2

Hint

[Explanation for Sample Input/Output 1]

There is more than one way to change it. One possible result is: 03-22\text{03-22}.

[Explanation for Sample Input/Output 2]

One possible result is: 02-09\text{02-09}.

[Explanation for Sample Input/Output 3]

One possible result is: 07-09\text{07-09}.

[Constraints]

For 100%100\% of the testdata, MM\text{MM} and DD\text{DD} are guaranteed to be 44 digits.

update: 2024/07/04 Added one hack case.

Translated by ChatGPT 5