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>
using namespace std;
inline int min(const int &x, const int &y) { return x < y ? x : y; }
inline long long min(const long long &x, const long long &y) {
  return x < y ? x : y;
}
inline double min(const double &x, const double &y) { return x < y ? x : y; }
inline int max(const int &x, const int &y) { return x > y ? x : y; }
inline long long max(const long long &x, const long long &y) {
  return x > y ? x : y;
}
inline double max(const double &x, const double &y) { return x > y ? x : y; }
template <class T>
inline void _updmin(T &x, const T &y) {
  if (x > y) x = y;
}
template <class T>
inline void _updmax(T &x, const T &y) {
  if (x < y) x = y;
}
template <class T>
inline T _lowbit(const T &x) {
  return (x ^ (x - 1)) & x;
}
template <class T>
inline int _bitsize(const T &x) {
  return (x == 0) ? 0 : (1 + bitsize(x & (x - 1)));
}
const double _pi = acos(-1.0);
const double _eps = 1e-5;
template <class T>
inline T _sqr(const T &x) {
  return x * x;
}
template <class T>
inline T _gcd(const T &x, const T &y) {
  if (x < 0) return _gcd(-x, y);
  if (y < 0) return _gcd(x, -y);
  return (y == 0) ? x : _gcd(y, x % y);
}
template <class T>
inline T _lcm(const T &x, const T &y) {
  if (x < 0) return _lcm(-x, y);
  if (y < 0) return _lcm(x, -y);
  return x * (y / _gcd(x, y));
}
template <class T>
inline T _euc(const T &a, const T &b, T &x, T &y) {
  if (a < 0) {
    T d = _euc(-a, b, x, y);
    x = -x;
    return d;
  }
  if (b < 0) {
    T d = _euc(a, -b, x, y);
    y = -y;
    return d;
  }
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  } else {
    T d = _euc(b, a % b, x, y);
    T t = x;
    x = y;
    y = t - (a / b) * y;
    return d;
  }
}
template <class T>
inline vector<pair<T, int> > _fac(T n) {
  vector<pair<T, int> > ret;
  for (T i = 2; n > 1;) {
    if (n % i == 0) {
      int cnt = 0;
      for (; n % i == 0; cnt++, n /= i)
        ;
      ret.push_back(make_pair(i, cnt));
    }
    i++;
    if (i > n / i) i = n;
  }
  if (n > 1) ret.push_back(make_pair(n, 1));
  return ret;
}
template <class T>
inline int _prm(const T &x) {
  if (x <= 1) return 0;
  for (T i = 2; sqr(i) <= x; i++)
    if (x % i == 0) return 0;
  return 1;
}
template <class T>
inline T _phi(T x) {
  vector<pair<T, int> > f = _fac(x);
  T ret = x;
  for (int i = 0; i < ((int)(f.size())); i++)
    ret = ret / f[i].first * (f[i].first - 1);
  return ret;
}
template <class T>
inline T _inv(T a, T b) {
  T x, y;
  _euc(a, b, x, y);
  if (x == 0) x = 1;
  return x;
}
char a[1100000];
int ans, now, top, bot;
int main() {
  while (scanf("%s", a) != EOF) {
    now = top = bot = 0;
    for (int i = 0; a[i]; i++) {
      now += (a[i] == '+') ? 1 : -1;
      _updmax(top, now);
      _updmin(bot, now);
    }
    ans = top + abs(bot);
    printf("%d\n", ans);
  }
  return 0;
}