#abc283c. C - Cash Register

C - Cash Register

Score : 300300 points

问题陈述

Takahashi 是一名收银员。

收银机上有 1111 个按键:000123456789。收银机初始显示为 00。每当他按下键 00,显示的数字就会乘以 100100;当他按下其他任意一个键时,显示的数字会先乘以 1010,然后再加上按键上所写的数字。

Takahashi 希望收银机能显示一个整数 SS。至少需要多少次按键操作才能使收银机显示出 SS

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

Takahashi is a cashier.

There is a cash register with 1111 keys: 00, 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. The cash register initially displays 00. Whenever he types the key 00, the displayed number is multiplied by 100100; whenever he types one of the others, the displayed number is multiplied by 1010, and then added by the number written on the key.

Takahashi wants the cash register to display an integer SS. At least how many keystrokes are required to make it display SS?

Constraints

  • 1S101000001\leq S\leq 10^{100000}
  • SS is an integer.

Input

The input is given from Standard Input in the following format:

SS

Output

Print the answer in a line.

Sample Input 1

40004

Sample Output 1

4

For example, the following four keystrokes make the cash register display 4000440004. Initially, the cash register displays 00.

  • Type the key 4. It now displays 44.
  • Type the key 00. It now displays 400400.
  • Type the key 0. It now displays 40004000.
  • Type the key 4. It now displays 4000440004.

He cannot make it display 4000440004 with three or fewer keystrokes, so 44 should be printed.

Sample Input 2

1355506027

Sample Output 2

10

Sample Input 3

10888869450418352160768000001

Sample Output 3

27

Note that SS may not fit into a 6464-bit\operatorname{bit} integer type.

update @ 2024/3/10 11:51:45