

def find_index(i, stack):
    while i < len(stack):
        if stack[i] == stack[i-1]:
            return i
        i += 1
    return i

def find_index2(i, stack, plus):
    while i < len(stack):
        if stack[i] == plus and stack[i] == stack[i-1]:
            return i
        i += 1
    return i


def flip(i1, i2, stack):
    for flipi in range((i2 - i1 + 1) // 2):
        stack[i1 + flipi], stack[i2 - flipi] = stack[i2 - flipi], stack[i1 + flipi] 

stack = list(map(lambda x: x == '+', input()))
# stack = [True, False, True, False, False, True]
# print(stack)


plus = len(list(filter(lambda x : x, stack)))
minus = len(list(filter(lambda x : not x, stack)))

count = 0

if plus != minus:
    pluslarger = plus > minus


    if stack[0] != pluslarger:
        index2 = find_index2(0, stack, not stack[0])
        flip(0, index2 -1 ,stack)
        count += 1

    

i = 1
while True:
    index1 = find_index(i, stack)
    if index1 == len(stack):
        print(count)
        break
    index2 = find_index2(index1 + 1, stack, not stack[index1])
    
    flip(index1, index2 - 1, stack)
    count += 1
    
    



