"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.main = function (S) {
    var sList = S.split('');
    var res = 0;
    var st = [];
    for (var i = 0; i < sList.length; i++) {
        if (st.length === 0 || st[st.length - 1] === sList[i]) {
            st.push(sList[0]);
        }
        else {
            res += 2;
            st.pop();
        }
    }
    return res;
};
var input = require('fs').readFileSync('/dev/stdin', 'UTF-8');
var lines = input.split('\n');
var res = exports.main(lines[0]);
console.log(res);
