题库练习 A pile of stones
← 上一题 下一题 →

A12644 | A pile of stones

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

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.

输入格式

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).

输出格式

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

输入输出样例

输入 #1
3
---
输出 #1
0
输入 #2
4
++++
输出 #2
4
输入 #3
2
-+
输出 #3
1
输入 #4
5
++-++
输出 #4
3
C++ 编辑器
输入
输出