Problem: 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.

Input

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.

Output

Print the sought minimum number of people

Examples

Input

+-+-+


Output

1


Input

---

Output

3

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (((a * b) / gcd(a, b))); }
long long phi(long long n) {
  long long result = n;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      result -= result / i;
    }
  }
  if (n > 1) result -= result / n;
  return result;
}
long long binpow(long long a, long long n, long long c) {
  long long res = 1;
  while (n) {
    if (n & 1) res *= a;
    res %= c;
    a *= a;
    a %= c;
    n >>= 1;
  }
  res = (res + c) % c;
  return res;
}
int nxi(int n) {
  bool min = 0;
  char c;
  n = 0;
  while ((c = getc(stdin)) && c <= 32)
    ;
  if (c == '-')
    min = 1;
  else
    n = c - 48;
  while ((c = getc(stdin)) && c > 32) n = (n << 3) + (n << 1) + c - 48;
  if (min) n = -n;
  return n;
}
void prl(int n) {
  if (n == 0) {
    puts("0");
    return;
  }
  if (n < 0) {
    putchar('-');
    n = -n;
  }
  static int s[10];
  int top = 0;
  while (n > 0) s[top++] = n % 10, n /= 10;
  while (top--) putchar(s[top] + 48);
  puts("");
}
using namespace std;
const int nmax = 100010;
vector<int> v;
int n;
string s;
bool can(int x) {
  set<int> inside, outside;
  for (int i = 0; i < x; i++) {
    inside.clear();
    outside.clear();
    for (int j = 0; j < i; j++) inside.insert(j);
    for (int j = i; j < x; j++) outside.insert(j);
    bool dd = 1;
    for (int i = 0; i < s.size(); i++) {
      if (!dd) break;
      char c = s[i];
      if (c == '+') {
        if (outside.size() == 0) dd = 0;
        if (!dd) break;
        int xx = *outside.begin();
        inside.insert(xx);
        outside.erase(xx);
      } else {
        if (inside.size() == 0) dd = 0;
        if (!dd) break;
        int xx = *inside.begin();
        inside.erase(xx);
        outside.insert(xx);
      }
    }
    if (dd) return 1;
  }
  return 0;
}
bool can3(int x) {
  set<int> inside, outside;
  for (int i = 0; i < x; i++) {
    inside.clear();
    outside.clear();
    for (int j = 0; j < i; j++) outside.insert(j);
    for (int j = i; j < x; j++) inside.insert(j);
    bool dd = 1;
    for (int i = 0; i < s.size(); i++) {
      if (!dd) break;
      char c = s[i];
      if (c == '+') {
        if (outside.size() == 0) dd = 0;
        if (!dd) break;
        int xx = *outside.begin();
        inside.insert(xx);
        outside.erase(xx);
      } else {
        if (inside.size() == 0) dd = 0;
        if (!dd) break;
        int xx = *inside.begin();
        inside.erase(xx);
        outside.insert(xx);
      }
    }
    if (dd) return 1;
  }
  return 0;
}
int main() {
  srand(time(0));
  cin >> s;
  int l = 1, r = 300;
  while (l + 1 < r) {
    int m = (l + r) >> 1;
    if (can(m) || can3(m))
      r = m;
    else
      l = m;
  }
  while ((can(r) || can3(r)) && r - 1 >= 1) r--;
  if (!(can(r) || can3(r))) r++;
  cout << r << endl;
  return 0;
}