input = require('fs').readFileSync('/dev/stdin', 'utf8')
lines = input.split('\n')
S = lines.shift().split('')
cnt = 0
p = S[0]
for (i=1; i<S.length; i++) {
    if ((p == 0 && S[i] == 1) || (p == 1 && S[i] == 0)) {
        cnt += 2
        S[i] = '2'
        S[idx] = '2'
        i = idx - 1
        while(S[i] == '2') {
            i--
        }
    }
    if (S[i] != '2') {
        p = S[i]
        idx = i
    }
}
console.log(cnt)
