"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.main = function (S) {
    var sList = S.split('');
    var res = 0;
    var flg = true;
    while (flg) {
        var cnt = 0;
        for (var i = 0; i < sList.length - 1; i++) {
            if ((sList[i] === '0' && sList[i + 1] === '1') ||
                (sList[i] === '1' && sList[i + 1] === '0')) {
                sList[i] = 'removed';
                sList[i + 1] = 'removed';
                cnt += 2;
            }
        }
        sList = sList.filter(function (s) { return s !== 'removed'; });
        if (cnt === 0) {
            flg = false;
        }
        res += cnt;
    }
    return res;
};
var input = require('fs').readFileSync('/dev/stdin', 'UTF-8');
var res = exports.main(input);
console.log(res);
