There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's…
- User
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.
Examples
Input
+-++
Output
2
Input
-+--
Output
-2
Input
Output
-4
Assistant
We are asked to solve a simple problem: given a string S of length 4 consisting of '+' and '-' characters, starting from 0, for each '+' add 1, for each '-' subtract 1, output final value. Straightforward.
We need to output an integer.
Implementation: count number of '+', number of '-', then result = plus - minus. Or loop.
Given the problem is trivial, but we must produce final answer.
We can write in Python.
But the user says: "There is always an integer in Takahashi's mind." Probably from AtCoder problem.
We'll produce solution code.
However, we must adhere to instructions: produce final output? The user says "Provide the final answer" as ChatGPT with code? Usually these are programming tasks, but the user might expect solution explanation and code.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.