# coding: utf-8

import re

def _main():
    text = input()
    count = 0

    while True:
        new_text = re.sub(r'01|10', '', text)

        if text == new_text:
            break
        else:
            count += len(text) - len(new_text)
            text = new_text

    print(count)



if __name__ == '__main__':
    _main()