#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;
}
