import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		// String[] strArr = str.split(" ");
		// N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		ArrayList<Integer> cube = new ArrayList<Integer>();
		for (int i = 0; i < str.length(); i++) {
			if (str.charAt(i) == '1')
				cube.add(1);
			else
				cube.add(0);
		}

		for (int idx = 0; cube.size() > idx + 1;) {
			if (cube.get(idx) != cube.get(idx + 1)) {
				cube.remove(idx);
				cube.remove(idx);
				idx--;
				if (idx < 0)
					idx = 0;
			} else
				idx++;
		}
		System.out.println(str.length() - cube.size());

	}

	public boolean hasNext() {
		return cnt < N;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
	}

	public void solve() {

	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
	}
} Main public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
	} main {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) Solver solver = new Solver(); solver new Solver() solver.init() solver.init solver solver.readHead(in.readLine()) solver.readHead solver in.readLine() in.readLine in String args[] args class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		// String[] strArr = str.split(" ");
		// N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		ArrayList<Integer> cube = new ArrayList<Integer>();
		for (int i = 0; i < str.length(); i++) {
			if (str.charAt(i) == '1')
				cube.add(1);
			else
				cube.add(0);
		}

		for (int idx = 0; cube.size() > idx + 1;) {
			if (cube.get(idx) != cube.get(idx + 1)) {
				cube.remove(idx);
				cube.remove(idx);
				idx--;
				if (idx < 0)
					idx = 0;
			} else
				idx++;
		}
		System.out.println(str.length() - cube.size());

	}

	public boolean hasNext() {
		return cnt < N;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
	}

	public void solve() {

	}
} Solver int N; N int cnt; cnt public void init() {
		N = 0;
		cnt = 0;
	} init {
		N = 0;
		cnt = 0;
	} N = 0 N 0 cnt = 0 cnt 0 public void readHead(String str) {
		// String[] strArr = str.split(" ");
		// N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		ArrayList<Integer> cube = new ArrayList<Integer>();
		for (int i = 0; i < str.length(); i++) {
			if (str.charAt(i) == '1')
				cube.add(1);
			else
				cube.add(0);
		}

		for (int idx = 0; cube.size() > idx + 1;) {
			if (cube.get(idx) != cube.get(idx + 1)) {
				cube.remove(idx);
				cube.remove(idx);
				idx--;
				if (idx < 0)
					idx = 0;
			} else
				idx++;
		}
		System.out.println(str.length() - cube.size());

	} readHead {
		// String[] strArr = str.split(" ");
		// N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		ArrayList<Integer> cube = new ArrayList<Integer>();
		for (int i = 0; i < str.length(); i++) {
			if (str.charAt(i) == '1')
				cube.add(1);
			else
				cube.add(0);
		}

		for (int idx = 0; cube.size() > idx + 1;) {
			if (cube.get(idx) != cube.get(idx + 1)) {
				cube.remove(idx);
				cube.remove(idx);
				idx--;
				if (idx < 0)
					idx = 0;
			} else
				idx++;
		}
		System.out.println(str.length() - cube.size());

	} ArrayList<Integer> cube = new ArrayList<Integer>(); cube new ArrayList<Integer>() for (int i = 0; i < str.length(); i++) {
			if (str.charAt(i) == '1')
				cube.add(1);
			else
				cube.add(0);
		} int i = 0; int i = 0; i 0 i < str.length() i str.length() str.length str i++ i++ i {
			if (str.charAt(i) == '1')
				cube.add(1);
			else
				cube.add(0);
		} {
			if (str.charAt(i) == '1')
				cube.add(1);
			else
				cube.add(0);
		} if (str.charAt(i) == '1')
				cube.add(1);
			else
				cube.add(0); str.charAt(i) == '1' str.charAt(i) str.charAt str i '1' cube.add(1) cube.add cube 1 cube.add(0) cube.add cube 0 for (int idx = 0; cube.size() > idx + 1;) {
			if (cube.get(idx) != cube.get(idx + 1)) {
				cube.remove(idx);
				cube.remove(idx);
				idx--;
				if (idx < 0)
					idx = 0;
			} else
				idx++;
		} int idx = 0; int idx = 0; idx 0 cube.size() > idx + 1 cube.size() cube.size cube idx + 1 idx 1 {
			if (cube.get(idx) != cube.get(idx + 1)) {
				cube.remove(idx);
				cube.remove(idx);
				idx--;
				if (idx < 0)
					idx = 0;
			} else
				idx++;
		} {
			if (cube.get(idx) != cube.get(idx + 1)) {
				cube.remove(idx);
				cube.remove(idx);
				idx--;
				if (idx < 0)
					idx = 0;
			} else
				idx++;
		} if (cube.get(idx) != cube.get(idx + 1)) {
				cube.remove(idx);
				cube.remove(idx);
				idx--;
				if (idx < 0)
					idx = 0;
			} else
				idx++; cube.get(idx) != cube.get(idx + 1) cube.get(idx) cube.get cube idx cube.get(idx + 1) cube.get cube idx + 1 idx 1 {
				cube.remove(idx);
				cube.remove(idx);
				idx--;
				if (idx < 0)
					idx = 0;
			} cube.remove(idx) cube.remove cube idx cube.remove(idx) cube.remove cube idx idx-- idx if (idx < 0)
					idx = 0; idx < 0 idx 0 idx = 0 idx 0 idx++ idx System.out.println(str.length() - cube.size()) System.out.println System.out System System.out str.length() - cube.size() str.length() str.length str cube.size() cube.size cube String str str public boolean hasNext() {
		return cnt < N;
	} hasNext {
		return cnt < N;
	} return cnt < N; cnt < N cnt N public void readBody(String str) {
		// System.out.println(str);
		cnt++;
	} readBody {
		// System.out.println(str);
		cnt++;
	} cnt++ cnt String str str public void solve() {

	} solve {

	}
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		// String[] strArr = str.split(" ");
		// N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		ArrayList<Integer> cube = new ArrayList<Integer>();
		for (int i = 0; i < str.length(); i++) {
			if (str.charAt(i) == '1')
				cube.add(1);
			else
				cube.add(0);
		}

		for (int idx = 0; cube.size() > idx + 1;) {
			if (cube.get(idx) != cube.get(idx + 1)) {
				cube.remove(idx);
				cube.remove(idx);
				idx--;
				if (idx < 0)
					idx = 0;
			} else
				idx++;
		}
		System.out.println(str.length() - cube.size());

	}

	public boolean hasNext() {
		return cnt < N;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
	}

	public void solve() {

	}
}
