AtCoder Beginner Contest 101
翻译中…
Problem Statement
翻译中…
There is always an integer in Takahashi's mind.
翻译中…
Initially, the integer in Takahashi's mind is $0$. Takahashi is now going to eat four symbols, each of which is + or -. When he eats +, the integer in his mind increases by $1$; when he eats -, the integer in his mind decreases by $1$.
翻译中…
The symbols Takahashi is going to eat are given to you as a string $S$. The $i$-th character in $S$ is the $i$-th symbol for him to eat.
翻译中…
Find the integer in Takahashi's mind after he eats all the symbols.
翻译中…
Constraints
翻译中…
- The length of
$S$is$4$. - Each character in
$S$is+or-.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
S
翻译中…
Output
翻译中…
Print the integer in Takahashi's mind after he eats all the symbols.
翻译中…
样例
Input #1
+-++
Output #1
2
- Initially, the integer in Takahashi's mind is $0$.
- The first integer for him to eat is `+`. After eating it, the integer in his mind becomes $1$.
- The second integer to eat is `-`. After eating it, the integer in his mind becomes $0$.
- The third integer to eat is `+`. After eating it, the integer in his mind becomes $1$.
- The fourth integer to eat is `+`. After eating it, the integer in his mind becomes $2$.
Thus, the integer in Takahashi's mind after he eats all the symbols is $2$.
Input #2
-+--
Output #2
-2
Input #3
----
Output #3
-4
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。