import java.util.*;

public class Main{

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] s = S.toCharArray();
        
        int ans = 0;
        for(int i = 1; i <= s.length-1; i++){
          if((s[i-1] == '0' && s[i] == '1')||(s[i] == '0' && s[i-1] == '1')){
            ans += 2;
            s[i-1] = '5';
            s[i] = '5';
          }
        }
      
         int count1 = 0;
         int count0 = 0;
         for(int i = 0; i < s.length; i++){
           if(s[i] == '1'){
             count1++;
           }else if(s[i] == '0'){
             count0++;
           }
         }
      
        if(count1 > count0){
          ans += count0*2;
        }else{
          ans += count1*2;
        }
          System.out.println(ans);
        
	}
} import java.util.*; util.* java public class Main{

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] s = S.toCharArray();
        
        int ans = 0;
        for(int i = 1; i <= s.length-1; i++){
          if((s[i-1] == '0' && s[i] == '1')||(s[i] == '0' && s[i-1] == '1')){
            ans += 2;
            s[i-1] = '5';
            s[i] = '5';
          }
        }
      
         int count1 = 0;
         int count0 = 0;
         for(int i = 0; i < s.length; i++){
           if(s[i] == '1'){
             count1++;
           }else if(s[i] == '0'){
             count0++;
           }
         }
      
        if(count1 > count0){
          ans += count0*2;
        }else{
          ans += count1*2;
        }
          System.out.println(ans);
        
	}
} Main public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] s = S.toCharArray();
        
        int ans = 0;
        for(int i = 1; i <= s.length-1; i++){
          if((s[i-1] == '0' && s[i] == '1')||(s[i] == '0' && s[i-1] == '1')){
            ans += 2;
            s[i-1] = '5';
            s[i] = '5';
          }
        }
      
         int count1 = 0;
         int count0 = 0;
         for(int i = 0; i < s.length; i++){
           if(s[i] == '1'){
             count1++;
           }else if(s[i] == '0'){
             count0++;
           }
         }
      
        if(count1 > count0){
          ans += count0*2;
        }else{
          ans += count1*2;
        }
          System.out.println(ans);
        
	} main {

		Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] s = S.toCharArray();
        
        int ans = 0;
        for(int i = 1; i <= s.length-1; i++){
          if((s[i-1] == '0' && s[i] == '1')||(s[i] == '0' && s[i-1] == '1')){
            ans += 2;
            s[i-1] = '5';
            s[i] = '5';
          }
        }
      
         int count1 = 0;
         int count0 = 0;
         for(int i = 0; i < s.length; i++){
           if(s[i] == '1'){
             count1++;
           }else if(s[i] == '0'){
             count0++;
           }
         }
      
        if(count1 > count0){
          ans += count0*2;
        }else{
          ans += count1*2;
        }
          System.out.println(ans);
        
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc char[] s = S.toCharArray(); s S.toCharArray() S.toCharArray S int ans = 0; ans 0 for(int i = 1; i <= s.length-1; i++){
          if((s[i-1] == '0' && s[i] == '1')||(s[i] == '0' && s[i-1] == '1')){
            ans += 2;
            s[i-1] = '5';
            s[i] = '5';
          }
        } int i = 1; int i = 1; i 1 i <= s.length-1 i s.length-1 s.length s s.length 1 i++ i++ i {
          if((s[i-1] == '0' && s[i] == '1')||(s[i] == '0' && s[i-1] == '1')){
            ans += 2;
            s[i-1] = '5';
            s[i] = '5';
          }
        } {
          if((s[i-1] == '0' && s[i] == '1')||(s[i] == '0' && s[i-1] == '1')){
            ans += 2;
            s[i-1] = '5';
            s[i] = '5';
          }
        } if((s[i-1] == '0' && s[i] == '1')||(s[i] == '0' && s[i-1] == '1')){
            ans += 2;
            s[i-1] = '5';
            s[i] = '5';
          } (s[i-1] == '0' && s[i] == '1')||(s[i] == '0' && s[i-1] == '1') (s[i-1] == '0' && s[i] == '1') s[i-1] == '0' s[i-1] s i-1 i 1 '0' s[i] == '1' s[i] s i '1' (s[i] == '0' && s[i-1] == '1') s[i] == '0' s[i] s i '0' s[i-1] == '1' s[i-1] s i-1 i 1 '1' {
            ans += 2;
            s[i-1] = '5';
            s[i] = '5';
          } ans += 2 ans 2 s[i-1] = '5' s[i-1] s i-1 i 1 '5' s[i] = '5' s[i] s i '5' int count1 = 0; count1 0 int count0 = 0; count0 0 for(int i = 0; i < s.length; i++){
           if(s[i] == '1'){
             count1++;
           }else if(s[i] == '0'){
             count0++;
           }
         } int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
           if(s[i] == '1'){
             count1++;
           }else if(s[i] == '0'){
             count0++;
           }
         } {
           if(s[i] == '1'){
             count1++;
           }else if(s[i] == '0'){
             count0++;
           }
         } if(s[i] == '1'){
             count1++;
           }else if(s[i] == '0'){
             count0++;
           } s[i] == '1' s[i] s i '1' {
             count1++;
           } count1++ count1 if(s[i] == '0'){
             count0++;
           } s[i] == '0' s[i] s i '0' {
             count0++;
           } count0++ count0 if(count1 > count0){
          ans += count0*2;
        }else{
          ans += count1*2;
        } count1 > count0 count1 count0 {
          ans += count0*2;
        } ans += count0*2 ans count0*2 count0 2 {
          ans += count1*2;
        } ans += count1*2 ans count1*2 count1 2 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] s = S.toCharArray();
        
        int ans = 0;
        for(int i = 1; i <= s.length-1; i++){
          if((s[i-1] == '0' && s[i] == '1')||(s[i] == '0' && s[i-1] == '1')){
            ans += 2;
            s[i-1] = '5';
            s[i] = '5';
          }
        }
      
         int count1 = 0;
         int count0 = 0;
         for(int i = 0; i < s.length; i++){
           if(s[i] == '1'){
             count1++;
           }else if(s[i] == '0'){
             count0++;
           }
         }
      
        if(count1 > count0){
          ans += count0*2;
        }else{
          ans += count1*2;
        }
          System.out.println(ans);
        
	}
} public class Main{

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] s = S.toCharArray();
        
        int ans = 0;
        for(int i = 1; i <= s.length-1; i++){
          if((s[i-1] == '0' && s[i] == '1')||(s[i] == '0' && s[i-1] == '1')){
            ans += 2;
            s[i-1] = '5';
            s[i] = '5';
          }
        }
      
         int count1 = 0;
         int count0 = 0;
         for(int i = 0; i < s.length; i++){
           if(s[i] == '1'){
             count1++;
           }else if(s[i] == '0'){
             count0++;
           }
         }
      
        if(count1 > count0){
          ans += count0*2;
        }else{
          ans += count1*2;
        }
          System.out.println(ans);
        
	}
} Main
import java.util.*;

public class Main{

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] s = S.toCharArray();
        
        int ans = 0;
        for(int i = 1; i <= s.length-1; i++){
          if((s[i-1] == '0' && s[i] == '1')||(s[i] == '0' && s[i-1] == '1')){
            ans += 2;
            s[i-1] = '5';
            s[i] = '5';
          }
        }
      
         int count1 = 0;
         int count0 = 0;
         for(int i = 0; i < s.length; i++){
           if(s[i] == '1'){
             count1++;
           }else if(s[i] == '0'){
             count0++;
           }
         }
      
        if(count1 > count0){
          ans += count0*2;
        }else{
          ans += count1*2;
        }
          System.out.println(ans);
        
	}
}