C - Calculator Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 200

問題文

00, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 のボタンがある電卓があります。
この電卓で文字列 x が表示されている時に b のボタンを押すと、表示される文字列は x の末尾に b を連結したものとなります。

最初、電卓には空文字列 ( 0 文字の文字列 ) が表示されています。
この電卓に文字列 S を表示させるためにボタンを押す回数の最小値を求めてください。

制約

  • S0, 1, 2, 3, 4, 5, 6, 7, 8, 9 からなる長さ 1 以上 1000 以下の列
  • S の先頭は 0 でない

入力

入力は以下の形式で標準入力から与えられる。

S

出力

答えを整数として出力せよ。


入力例 1

1000000007

出力例 1

6

1000000007 を表示させるには、 1, 00, 00, 00, 00, 7 のボタンをこの順に押せばよく、ボタンを押した回数は 6 回で、これが達成可能な最小値です。


入力例 2

998244353

出力例 2

9

入力例 3

32000

出力例 3

4

Score : 200 points

Problem Statement

There is a calculator with the buttons 00, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
When a string x is displayed on this calculator and you press a button b, the resulting displayed string becomes the string x with b appended to its end.

Initially, the calculator displays the empty string (a string of length 0).
Find the minimum number of button presses required to display the string S on this calculator.

Constraints

  • S is a string of length at least 1 and at most 1000, consisting of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
  • The first character of S is not 0.

Input

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

S

Output

Print the answer as an integer.


Sample Input 1

1000000007

Sample Output 1

6

To display 1000000007, you can press the buttons 1, 00, 00, 00, 00, 7 in this order. The total number of button presses is 6, and this is the minimum possible.


Sample Input 2

998244353

Sample Output 2

9

Sample Input 3

32000

Sample Output 3

4