102832: [Atcoder]ABC283 C - Cash Register

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $300$ points

Problem Statement

Takahashi is a cashier.

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

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

Constraints

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

Input

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

$S$

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 $40004$. Initially, the cash register displays $0$.

  • Type the key 4. It now displays $4$.
  • Type the key 00. It now displays $400$.
  • Type the key 0. It now displays $4000$.
  • Type the key 4. It now displays $40004$.

He cannot make it display $40004$ with three or fewer keystrokes, so $4$ should be printed.


Sample Input 2

1355506027

Sample Output 2

10

Sample Input 3

10888869450418352160768000001

Sample Output 3

27

Note that $S$ may not fit into a $64$-$\operatorname{bit}$ integer type.

Input

题意翻译

给定一个长度为 $n$ 的数组 $a_i$,$q$ 次询问: + $op = 1$,$a_i \gets k$。 + $op = 2$,输出 $a_i$。 translated by @[liangbowen](https://www.luogu.com.cn/user/367488)。

Output

分数:300分

问题描述

高桥君是一名收银员。

有一个有11个键的收银机:000123456789。收银机最初显示0。每当他按下00键,显示的数字就乘以100;每当他按下其他键之一,显示的数字就乘以10,然后加上键上写的数字。

高桥君想让收银机显示一个整数$S$。至少需要多少次按键才能使其显示$S$?

限制条件

  • $1\leq S\leq 10^{100000}$
  • $S$是一个整数。

输入

输入从标准输入以以下格式给出:

$S$

输出

在一行中打印答案。


样例输入1

40004

样例输出1

4

例如,以下四个按键可以使收银机显示$40004$。最初,收银机显示$0$。

  • 按下4键。现在显示$4$。
  • 按下00键。现在显示$400$。
  • 按下0键。现在显示$4000$。
  • 按下4键。现在显示$40004$。

他不能用三个或更少的按键使其显示$40004$,所以应该打印$4$。


样例输入2

1355506027

样例输出2

10

样例输入3

10888869450418352160768000001

样例输出3

27

请注意,$S$可能不适应64位整数类型。

加入题单

算法标签: