484. Final Value After Operations
EasySimulation
X starts at 0. Each operation is ++X, X++, --X or X--. Print the final value of X.
Input format
Line 1: n Line 2: n operations
Output format
The final value.
Example 1
Input
3 --X X++ X++
Output
1
Example 2
Input
3 ++X ++X X++
Output
3
Constraints
1 ≤ n ≤ 100
Read input from standard input and print the answer to standard output. Your code is judged against 3 test cases, most of them hidden.
Loading the MyLoginn IDE…