import sys


def main():
    lines = sys.stdin.readlines()[0]
    s = lines.rstrip('\n')
    size = len(s)
    pat0 = '01'
    pat1 = '10'
    while(True):
        if pat0 in s:
            parts = s.split(pat0)
        elif pat1 in s:
            parts = s.split(pat1)
        else:
            break
        s = ''.join(parts)
    print(size - len(s))
        
        


if __name__ == '__main__':
    main()
    