#include <bits/stdc++.h>
using namespace std;
char a[4005], f[4005];
int alen, o, p, top;
int main() {
  scanf("%s", &a);
  alen = strlen(a);
  for (int i = 0; i < alen; i++)
    if (f[top] == '+') {
      if (a[i] == '+')
        f[++top] = '+', o = max(o, top);
      else
        top--;
    } else if (f[top] == '-') {
      if (a[i] == '-')
        f[++top] = '-', p = max(p, top);
      else
        top--;
    } else {
      if (a[i] == '+')
        f[++top] = '+', o = max(o, 1);
      else
        f[++top] = '-', p = max(p, 1);
    }
  printf("%d\n", o + p);
  return 0;
}
