101870: [AtCoder]ABC187 A - Large Digits

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

Description

Score : $100$ points

Problem Statement

For an integer $n$, let $S(n)$ be the sum of digits in the decimal notation of $n$. For example, we have $S(123) = 1 + 2 + 3 = 6$.

Given two $3$-digit integers $A$ and $B$, find the greater of $S(A)$ and $S(B)$.

Constraints

  • All values in input are integers.
  • $100 \le A, B \le 999$

Input

Input is given from Standard Input in the following format:

$A$ $B$

Output

Print the value of the greater of $S(A)$ and $S(B)$.
If these are equal, print $S(A)$.


Sample Input 1

123 234

Sample Output 1

9

We have $S(123) = 1 + 2 + 3 = 6$ and $S(234) = 2 + 3 + 4 = 9$, so we should print the greater of these: $9$.


Sample Input 2

593 953

Sample Output 2

17

Sample Input 3

100 999

Sample Output 3

27

Input

题意翻译

对于一个整数$N$,它每位数的和可以被表示为$S(N)$. 比如$S(123)$ = $1$ + $2$ + $3$ = $6$. 输入$A$,$B$两个三位数,请计算$S(A)$和$S(B)$中较大的数,并将其输出,如果$S(A)$和$S(B)$一样大,则输出$S(A)$.

加入题单

算法标签: