No.656 Golf
タグ : / 解いたユーザー数 589
作問者 :
nmnmnmnmnmnmnm
/ テスター :
Problem Statement
A-kun's job is to calculate golf scorecards.
In golf, the score increases by 1 each time the ball is hit.
For example, if 4 strokes were taken on a hole, 4 is written on the scorecard and the score is 4.
As an exception, if 10 or more strokes were taken, 0 is written on the scorecard and the score is 10.
A-kun is given a scorecard for 9 holes, so calculate the total score.
Note that, by the nature of the sport of golf, it is impossible to finish a hole in 0 strokes!
Input
$S$
The scores for the 9 holes are given as a string $S$.
The i-th digit is the entry on the scorecard for the i-th hole.
The characters used are '0' to '9', and the length of the string is always 9.
Output
Output the total score, followed by a newline.
Sample
Sample 1
Input
444444444
Output
36
All 9 holes were played in 4 strokes each. Therefore, the total score is 36.
Sample 2
Input
111111110
Output
18
Holes 1 through 8 were all played in 1 stroke each, but 10 or more strokes were taken on the 9th hole.
Note that when 10 or more strokes are taken, the entry is 0 and the score is counted as 10.
The total score is 18.
Sample 3
Input
404328039
Output
53
Sample 4
Input
000000000
Output
90
This is the maximum possible score.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。