Codeforces Round 559 (Div. 2)
A
A pile of stones
Codeforces
800
原题
←B →
翻译中…

Vasya has a pile, that consists of some number of stones. $n$ times he either took one stone from the pile or added one stone to the pile. The pile was non-empty before each operation of taking one stone from the pile.

翻译中…

You are given $n$ operations which Vasya has made. Find the minimal possible number of stones that can be in the pile after making these operations.

翻译中…

Input

翻译中…

The first line contains one positive integer $n$ — the number of operations, that have been made by Vasya ($1 \leq n \leq 100$).

翻译中…

The next line contains the string $s$, consisting of $n$ symbols, equal to "-" (without quotes) or "+" (without quotes). If Vasya took the stone on $i$-th operation, $s_i$ is equal to "-" (without quotes), if added, $s_i$ is equal to "+" (without quotes).

翻译中…

Output

翻译中…

Print one integer — the minimal possible number of stones that can be in the pile after these $n$ operations.

翻译中…

Note

翻译中…

In the first test, if Vasya had $3$ stones in the pile at the beginning, after making operations the number of stones will be equal to $0$. It is impossible to have less number of piles, so the answer is $0$. Please notice, that the number of stones at the beginning can't be less, than $3$, because in this case, Vasya won't be able to take a stone on some operation (the pile will be empty).

翻译中…

In the second test, if Vasya had $0$ stones in the pile at the beginning, after making operations the number of stones will be equal to $4$. It is impossible to have less number of piles because after making $4$ operations the number of stones in the pile increases on $4$ stones. So, the answer is $4$.

翻译中…

In the third test, if Vasya had $1$ stone in the pile at the beginning, after making operations the number of stones will be equal to $1$. It can be proved, that it is impossible to have less number of stones after making the operations.

翻译中…

In the fourth test, if Vasya had $0$ stones in the pile at the beginning, after making operations the number of stones will be equal to $3$.

翻译中…

样例

Input #1
3
---
Output #1
0
InputCopy OutputCopy
Input #2
4
++++
Output #2
4
InputCopy OutputCopy
Input #3
2
-+
Output #3
1
InputCopy OutputCopy
Input #4
5
++-++
Output #4
3
InputCopy OutputCopy
题目信息
题号
1159A
时间限制
1 s
内存限制
256 MB
标签
模拟
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。