#include int main() { char input; int books[100000], i = 0; fflush(stdin); while((input = getchar()) != '\n'){ getchar(); if (input == '+') { books[i] = 1; } else { books[i] = 0; } i++; } books[i] = -1; i = 0; long long flips = 0; while (books[i] != -1) { if (books[0] == 1) { while (books[i] == 1) i++; if (books[i] == 0) { while (books[i] == 0) i++; flips++; } } else { while (books[i] == 0) i++; if (books[i] == 1) { while (books[i] == 1) i++; flips++; } } } printf("%lld\n", flips); return 0; }