

def remove_data(data, ind_pre, ind_after):
    if ind_pre == 0:
        data_pre = ''
    else:
        data_pre = data[:ind_pre]
    if ind_after == len(data) - 1:
        data_after = ''
    else:
        data_after = data[ind_after + 1:]
    data_remove = data_pre + data_after
    return data_remove


def calc_data(data):
    flg = 1
    while flg:
        flg = 0
        for i in range(len(data) - 1):
            if data[i] != data[i + 1]:
                data = remove_data(data, i, i+1)
                flg = 1
                break
    return len(data)

def main():
    data = input()
    length = len(data)
    final_length = calc_data(data)
    print(length - final_length)


if __name__ == '__main__':
    main()