import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		List<Boolean> blue = new ArrayList<>();
		
		String str = sc.next();
		
		for (int i = 0; i < str.length(); i++) {
			blue.add(false);
			if (str.charAt(i) == '1') {
				blue.set(i, true);
			}
		}
		
		int count = 0;
		
		while (true) {
			int index1 = -1;
			int index2 = -1;
			
			int n = blue.size() / 2;
			
			for (int i = n; i < blue.size() - 1; i++) {
				if (blue.get(i) != blue.get(i + 1)) {
					index1 = i;
					break;
				}
			}
			
			for (int i = n - 1; i >= 0; i--) {
				if (blue.get(i) != blue.get(i + 1)) {
					index2 = i;
					break;
				}
			}
			
			int index = -1;
			
			if (index1 < 0){
				index = index2;
			} else if (index2 < 0) {
				index = index1;
			} else {
				if (index1 - n < n - index2) {
					index = index1;
				} else {
					index = index2;
				}
			}
			
			if (index < 0) {
				break;
			} else {
				for (int i = 0; i < 2; i++) {
					blue.remove(index);
				}
			}
			
			count += 2;
		}
		
		System.out.println(count);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		List<Boolean> blue = new ArrayList<>();
		
		String str = sc.next();
		
		for (int i = 0; i < str.length(); i++) {
			blue.add(false);
			if (str.charAt(i) == '1') {
				blue.set(i, true);
			}
		}
		
		int count = 0;
		
		while (true) {
			int index1 = -1;
			int index2 = -1;
			
			int n = blue.size() / 2;
			
			for (int i = n; i < blue.size() - 1; i++) {
				if (blue.get(i) != blue.get(i + 1)) {
					index1 = i;
					break;
				}
			}
			
			for (int i = n - 1; i >= 0; i--) {
				if (blue.get(i) != blue.get(i + 1)) {
					index2 = i;
					break;
				}
			}
			
			int index = -1;
			
			if (index1 < 0){
				index = index2;
			} else if (index2 < 0) {
				index = index1;
			} else {
				if (index1 - n < n - index2) {
					index = index1;
				} else {
					index = index2;
				}
			}
			
			if (index < 0) {
				break;
			} else {
				for (int i = 0; i < 2; i++) {
					blue.remove(index);
				}
			}
			
			count += 2;
		}
		
		System.out.println(count);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		List<Boolean> blue = new ArrayList<>();
		
		String str = sc.next();
		
		for (int i = 0; i < str.length(); i++) {
			blue.add(false);
			if (str.charAt(i) == '1') {
				blue.set(i, true);
			}
		}
		
		int count = 0;
		
		while (true) {
			int index1 = -1;
			int index2 = -1;
			
			int n = blue.size() / 2;
			
			for (int i = n; i < blue.size() - 1; i++) {
				if (blue.get(i) != blue.get(i + 1)) {
					index1 = i;
					break;
				}
			}
			
			for (int i = n - 1; i >= 0; i--) {
				if (blue.get(i) != blue.get(i + 1)) {
					index2 = i;
					break;
				}
			}
			
			int index = -1;
			
			if (index1 < 0){
				index = index2;
			} else if (index2 < 0) {
				index = index1;
			} else {
				if (index1 - n < n - index2) {
					index = index1;
				} else {
					index = index2;
				}
			}
			
			if (index < 0) {
				break;
			} else {
				for (int i = 0; i < 2; i++) {
					blue.remove(index);
				}
			}
			
			count += 2;
		}
		
		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		
		List<Boolean> blue = new ArrayList<>();
		
		String str = sc.next();
		
		for (int i = 0; i < str.length(); i++) {
			blue.add(false);
			if (str.charAt(i) == '1') {
				blue.set(i, true);
			}
		}
		
		int count = 0;
		
		while (true) {
			int index1 = -1;
			int index2 = -1;
			
			int n = blue.size() / 2;
			
			for (int i = n; i < blue.size() - 1; i++) {
				if (blue.get(i) != blue.get(i + 1)) {
					index1 = i;
					break;
				}
			}
			
			for (int i = n - 1; i >= 0; i--) {
				if (blue.get(i) != blue.get(i + 1)) {
					index2 = i;
					break;
				}
			}
			
			int index = -1;
			
			if (index1 < 0){
				index = index2;
			} else if (index2 < 0) {
				index = index1;
			} else {
				if (index1 - n < n - index2) {
					index = index1;
				} else {
					index = index2;
				}
			}
			
			if (index < 0) {
				break;
			} else {
				for (int i = 0; i < 2; i++) {
					blue.remove(index);
				}
			}
			
			count += 2;
		}
		
		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) List<Boolean> blue = new ArrayList<>(); blue new ArrayList<>() String str = sc.next(); str sc.next() sc.next sc for (int i = 0; i < str.length(); i++) {
			blue.add(false);
			if (str.charAt(i) == '1') {
				blue.set(i, true);
			}
		} int i = 0; int i = 0; i 0 i < str.length() i str.length() str.length str i++ i++ i {
			blue.add(false);
			if (str.charAt(i) == '1') {
				blue.set(i, true);
			}
		} {
			blue.add(false);
			if (str.charAt(i) == '1') {
				blue.set(i, true);
			}
		} blue.add(false) blue.add blue false if (str.charAt(i) == '1') {
				blue.set(i, true);
			} str.charAt(i) == '1' str.charAt(i) str.charAt str i '1' {
				blue.set(i, true);
			} blue.set(i, true) blue.set blue i true int count = 0; count 0 while (true) {
			int index1 = -1;
			int index2 = -1;
			
			int n = blue.size() / 2;
			
			for (int i = n; i < blue.size() - 1; i++) {
				if (blue.get(i) != blue.get(i + 1)) {
					index1 = i;
					break;
				}
			}
			
			for (int i = n - 1; i >= 0; i--) {
				if (blue.get(i) != blue.get(i + 1)) {
					index2 = i;
					break;
				}
			}
			
			int index = -1;
			
			if (index1 < 0){
				index = index2;
			} else if (index2 < 0) {
				index = index1;
			} else {
				if (index1 - n < n - index2) {
					index = index1;
				} else {
					index = index2;
				}
			}
			
			if (index < 0) {
				break;
			} else {
				for (int i = 0; i < 2; i++) {
					blue.remove(index);
				}
			}
			
			count += 2;
		} true {
			int index1 = -1;
			int index2 = -1;
			
			int n = blue.size() / 2;
			
			for (int i = n; i < blue.size() - 1; i++) {
				if (blue.get(i) != blue.get(i + 1)) {
					index1 = i;
					break;
				}
			}
			
			for (int i = n - 1; i >= 0; i--) {
				if (blue.get(i) != blue.get(i + 1)) {
					index2 = i;
					break;
				}
			}
			
			int index = -1;
			
			if (index1 < 0){
				index = index2;
			} else if (index2 < 0) {
				index = index1;
			} else {
				if (index1 - n < n - index2) {
					index = index1;
				} else {
					index = index2;
				}
			}
			
			if (index < 0) {
				break;
			} else {
				for (int i = 0; i < 2; i++) {
					blue.remove(index);
				}
			}
			
			count += 2;
		} int index1 = -1; index1 -1 1 int index2 = -1; index2 -1 1 int n = blue.size() / 2; n blue.size() / 2 blue.size() blue.size blue 2 for (int i = n; i < blue.size() - 1; i++) {
				if (blue.get(i) != blue.get(i + 1)) {
					index1 = i;
					break;
				}
			} int i = n; int i = n; i n i < blue.size() - 1 i blue.size() - 1 blue.size() blue.size blue 1 i++ i++ i {
				if (blue.get(i) != blue.get(i + 1)) {
					index1 = i;
					break;
				}
			} {
				if (blue.get(i) != blue.get(i + 1)) {
					index1 = i;
					break;
				}
			} if (blue.get(i) != blue.get(i + 1)) {
					index1 = i;
					break;
				} blue.get(i) != blue.get(i + 1) blue.get(i) blue.get blue i blue.get(i + 1) blue.get blue i + 1 i 1 {
					index1 = i;
					break;
				} index1 = i index1 i break; for (int i = n - 1; i >= 0; i--) {
				if (blue.get(i) != blue.get(i + 1)) {
					index2 = i;
					break;
				}
			} int i = n - 1; int i = n - 1; i n - 1 n 1 i >= 0 i 0 i-- i-- i {
				if (blue.get(i) != blue.get(i + 1)) {
					index2 = i;
					break;
				}
			} {
				if (blue.get(i) != blue.get(i + 1)) {
					index2 = i;
					break;
				}
			} if (blue.get(i) != blue.get(i + 1)) {
					index2 = i;
					break;
				} blue.get(i) != blue.get(i + 1) blue.get(i) blue.get blue i blue.get(i + 1) blue.get blue i + 1 i 1 {
					index2 = i;
					break;
				} index2 = i index2 i break; int index = -1; index -1 1 if (index1 < 0){
				index = index2;
			} else if (index2 < 0) {
				index = index1;
			} else {
				if (index1 - n < n - index2) {
					index = index1;
				} else {
					index = index2;
				}
			} index1 < 0 index1 0 {
				index = index2;
			} index = index2 index index2 if (index2 < 0) {
				index = index1;
			} else {
				if (index1 - n < n - index2) {
					index = index1;
				} else {
					index = index2;
				}
			} index2 < 0 index2 0 {
				index = index1;
			} index = index1 index index1 {
				if (index1 - n < n - index2) {
					index = index1;
				} else {
					index = index2;
				}
			} if (index1 - n < n - index2) {
					index = index1;
				} else {
					index = index2;
				} index1 - n < n - index2 index1 - n index1 n n - index2 n index2 {
					index = index1;
				} index = index1 index index1 {
					index = index2;
				} index = index2 index index2 if (index < 0) {
				break;
			} else {
				for (int i = 0; i < 2; i++) {
					blue.remove(index);
				}
			} index < 0 index 0 {
				break;
			} break; {
				for (int i = 0; i < 2; i++) {
					blue.remove(index);
				}
			} for (int i = 0; i < 2; i++) {
					blue.remove(index);
				} int i = 0; int i = 0; i 0 i < 2 i 2 i++ i++ i {
					blue.remove(index);
				} {
					blue.remove(index);
				} blue.remove(index) blue.remove blue index count += 2 count 2 System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		List<Boolean> blue = new ArrayList<>();
		
		String str = sc.next();
		
		for (int i = 0; i < str.length(); i++) {
			blue.add(false);
			if (str.charAt(i) == '1') {
				blue.set(i, true);
			}
		}
		
		int count = 0;
		
		while (true) {
			int index1 = -1;
			int index2 = -1;
			
			int n = blue.size() / 2;
			
			for (int i = n; i < blue.size() - 1; i++) {
				if (blue.get(i) != blue.get(i + 1)) {
					index1 = i;
					break;
				}
			}
			
			for (int i = n - 1; i >= 0; i--) {
				if (blue.get(i) != blue.get(i + 1)) {
					index2 = i;
					break;
				}
			}
			
			int index = -1;
			
			if (index1 < 0){
				index = index2;
			} else if (index2 < 0) {
				index = index1;
			} else {
				if (index1 - n < n - index2) {
					index = index1;
				} else {
					index = index2;
				}
			}
			
			if (index < 0) {
				break;
			} else {
				for (int i = 0; i < 2; i++) {
					blue.remove(index);
				}
			}
			
			count += 2;
		}
		
		System.out.println(count);
	}
} public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		List<Boolean> blue = new ArrayList<>();
		
		String str = sc.next();
		
		for (int i = 0; i < str.length(); i++) {
			blue.add(false);
			if (str.charAt(i) == '1') {
				blue.set(i, true);
			}
		}
		
		int count = 0;
		
		while (true) {
			int index1 = -1;
			int index2 = -1;
			
			int n = blue.size() / 2;
			
			for (int i = n; i < blue.size() - 1; i++) {
				if (blue.get(i) != blue.get(i + 1)) {
					index1 = i;
					break;
				}
			}
			
			for (int i = n - 1; i >= 0; i--) {
				if (blue.get(i) != blue.get(i + 1)) {
					index2 = i;
					break;
				}
			}
			
			int index = -1;
			
			if (index1 < 0){
				index = index2;
			} else if (index2 < 0) {
				index = index1;
			} else {
				if (index1 - n < n - index2) {
					index = index1;
				} else {
					index = index2;
				}
			}
			
			if (index < 0) {
				break;
			} else {
				for (int i = 0; i < 2; i++) {
					blue.remove(index);
				}
			}
			
			count += 2;
		}
		
		System.out.println(count);
	}
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		List<Boolean> blue = new ArrayList<>();
		
		String str = sc.next();
		
		for (int i = 0; i < str.length(); i++) {
			blue.add(false);
			if (str.charAt(i) == '1') {
				blue.set(i, true);
			}
		}
		
		int count = 0;
		
		while (true) {
			int index1 = -1;
			int index2 = -1;
			
			int n = blue.size() / 2;
			
			for (int i = n; i < blue.size() - 1; i++) {
				if (blue.get(i) != blue.get(i + 1)) {
					index1 = i;
					break;
				}
			}
			
			for (int i = n - 1; i >= 0; i--) {
				if (blue.get(i) != blue.get(i + 1)) {
					index2 = i;
					break;
				}
			}
			
			int index = -1;
			
			if (index1 < 0){
				index = index2;
			} else if (index2 < 0) {
				index = index1;
			} else {
				if (index1 - n < n - index2) {
					index = index1;
				} else {
					index = index2;
				}
			}
			
			if (index < 0) {
				break;
			} else {
				for (int i = 0; i < 2; i++) {
					blue.remove(index);
				}
			}
			
			count += 2;
		}
		
		System.out.println(count);
	}
}
