
sent = input()

def countWords(sen):
    words = 0
    i = 0

    while len(sen) > 1:
            if i + 1 < len(sen):
                if (sen[i] == sen[i+1] or sen[i] < sen[i+1]):
                    i += 1
                else:
                    words += 1
                    sen = sen[i+1:]
                    i = 0
            else:
                words += 1
                break
            print(sen, i)
    else:
        words += 1
            
    return words

print(countWords(sent))