import java.util.Scanner;

public class Main {
        public static void main(String[] args) {
                Scanner sc = new Scanner(System.in);

                String target = sc.next();

                int cnt = 0;
                while(true) {
                        if(target.indexOf("01") == -1 && target.indexOf("10") == -1) {
                                break;
                        }
                        String tmp = target;

                        target = target.replace("01", "");

                        cnt += tmp.length() - target.length();

                        tmp = target;

                        target = target.replace("10", "");

                        cnt += tmp.length() - target.length();
                }

                System.out.println(cnt);
        }
}
