301312: CF245E. Mishap in Club

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Mishap in Club

题意翻译

Polycarpus 很幸运地找到了一份在名叫 _Binary Cat_ 的咖啡馆当前台的工作。但不幸的是,这家咖啡馆在一天遭到了盗贼的光顾,导致咖啡馆里所有的冰淇淋不翼而飞。 从案发当天的晚上开始,Polycarpus 就很小心翼翼地记录着所有的进出咖啡馆的信息。具体地,当有人进入咖啡馆时,Polycarpus 在当前字符串后面写下一个字符 `+`;当有人离开咖啡馆时,Polycarpus 在当前字符串后面写下一个字符 `-`。所有记录的信息发生的时间互不相同。 直到警方开始调查这件事时,Polycarpus 已经写下了一个长度为 $n$ 的字符串。警方想通过这个字符串知道在这段时间里面至少有多少不同的人进出这家咖啡馆。注意一个人可能进出咖啡馆多次。 数据范围:$n\leqslant 300$。 Translated by Eason_AC

题目描述

Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen. On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visitor entered the club, Polycarpus put down character "+" in his notes. Similarly, each time a visitor left the club, Polycarpus put character "-" in his notes. We know that all cases of going in and out happened consecutively, that is, no two events happened at the same time. Polycarpus doesn't remember whether there was somebody in the club at the moment when his shift begun and at the moment when it ended. Right now the police wonders what minimum number of distinct people Polycarpus could have seen. Assume that he sees anybody coming in or out of the club. Each person could have come in or out an arbitrary number of times.

输入输出格式

输入格式


The only line of the input contains a sequence of characters "+" and "-", the characters are written one after another without any separators. The characters are written in the order, in which the corresponding events occurred. The given sequence has length from 1 to 300 characters, inclusive.

输出格式


Print the sought minimum number of people

输入输出样例

输入样例 #1

+-+-+

输出样例 #1

1

输入样例 #2

---

输出样例 #2

3

Input

题意翻译

Polycarpus 很幸运地找到了一份在名叫 _Binary Cat_ 的咖啡馆当前台的工作。但不幸的是,这家咖啡馆在一天遭到了盗贼的光顾,导致咖啡馆里所有的冰淇淋不翼而飞。 从案发当天的晚上开始,Polycarpus 就很小心翼翼地记录着所有的进出咖啡馆的信息。具体地,当有人进入咖啡馆时,Polycarpus 在当前字符串后面写下一个字符 `+`;当有人离开咖啡馆时,Polycarpus 在当前字符串后面写下一个字符 `-`。所有记录的信息发生的时间互不相同。 直到警方开始调查这件事时,Polycarpus 已经写下了一个长度为 $n$ 的字符串。警方想通过这个字符串知道在这段时间里面至少有多少不同的人进出这家咖啡馆。注意一个人可能进出咖啡馆多次。 数据范围:$n\leqslant 300$。 Translated by Eason_AC

加入题单

算法标签: