import java.util.*;
import java.util.Collections;
import java.util.ArrayList;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        String S = sc.next();
        int l = S.length();
        ArrayList<String> list = new ArrayList<String>();

        for(int i=0; i<l; i++){
            list.add(String.valueOf(S.charAt(i)));
        }

        Collections.sort(list);
        int x = 1;
        for(int i=1; i<l; i++){
            if(list.get(i).equals(list.get(i-1))){
                x += 1;
            }
            else{
                break;
            }
        }
        System.out.println(2 * Math.min(x, l - x));
    }
} import java.util.*; util.* java import java.util.Collections; Collections java.util import java.util.ArrayList; ArrayList java.util public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        String S = sc.next();
        int l = S.length();
        ArrayList<String> list = new ArrayList<String>();

        for(int i=0; i<l; i++){
            list.add(String.valueOf(S.charAt(i)));
        }

        Collections.sort(list);
        int x = 1;
        for(int i=1; i<l; i++){
            if(list.get(i).equals(list.get(i-1))){
                x += 1;
            }
            else{
                break;
            }
        }
        System.out.println(2 * Math.min(x, l - x));
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        String S = sc.next();
        int l = S.length();
        ArrayList<String> list = new ArrayList<String>();

        for(int i=0; i<l; i++){
            list.add(String.valueOf(S.charAt(i)));
        }

        Collections.sort(list);
        int x = 1;
        for(int i=1; i<l; i++){
            if(list.get(i).equals(list.get(i-1))){
                x += 1;
            }
            else{
                break;
            }
        }
        System.out.println(2 * Math.min(x, l - x));
    } main {
        Scanner sc = new Scanner(System.in);
 
        String S = sc.next();
        int l = S.length();
        ArrayList<String> list = new ArrayList<String>();

        for(int i=0; i<l; i++){
            list.add(String.valueOf(S.charAt(i)));
        }

        Collections.sort(list);
        int x = 1;
        for(int i=1; i<l; i++){
            if(list.get(i).equals(list.get(i-1))){
                x += 1;
            }
            else{
                break;
            }
        }
        System.out.println(2 * Math.min(x, l - x));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc int l = S.length(); l S.length() S.length S ArrayList<String> list = new ArrayList<String>(); list new ArrayList<String>() for(int i=0; i<l; i++){
            list.add(String.valueOf(S.charAt(i)));
        } int i=0; int i=0; i 0 i<l i l i++ i++ i {
            list.add(String.valueOf(S.charAt(i)));
        } {
            list.add(String.valueOf(S.charAt(i)));
        } list.add(String.valueOf(S.charAt(i))) list.add list String.valueOf(S.charAt(i)) String.valueOf String S.charAt(i) S.charAt S i Collections.sort(list) Collections.sort Collections list int x = 1; x 1 for(int i=1; i<l; i++){
            if(list.get(i).equals(list.get(i-1))){
                x += 1;
            }
            else{
                break;
            }
        } int i=1; int i=1; i 1 i<l i l i++ i++ i {
            if(list.get(i).equals(list.get(i-1))){
                x += 1;
            }
            else{
                break;
            }
        } {
            if(list.get(i).equals(list.get(i-1))){
                x += 1;
            }
            else{
                break;
            }
        } if(list.get(i).equals(list.get(i-1))){
                x += 1;
            }
            else{
                break;
            } list.get(i).equals(list.get(i-1)) list.get(i).equals list.get(i) list.get list i list.get(i-1) list.get list i-1 i 1 {
                x += 1;
            } x += 1 x 1 {
                break;
            } break; System.out.println(2 * Math.min(x, l - x)) System.out.println System.out System System.out 2 * Math.min(x, l - x) 2 Math.min(x, l - x) Math.min Math x l - x l x String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        String S = sc.next();
        int l = S.length();
        ArrayList<String> list = new ArrayList<String>();

        for(int i=0; i<l; i++){
            list.add(String.valueOf(S.charAt(i)));
        }

        Collections.sort(list);
        int x = 1;
        for(int i=1; i<l; i++){
            if(list.get(i).equals(list.get(i-1))){
                x += 1;
            }
            else{
                break;
            }
        }
        System.out.println(2 * Math.min(x, l - x));
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        String S = sc.next();
        int l = S.length();
        ArrayList<String> list = new ArrayList<String>();

        for(int i=0; i<l; i++){
            list.add(String.valueOf(S.charAt(i)));
        }

        Collections.sort(list);
        int x = 1;
        for(int i=1; i<l; i++){
            if(list.get(i).equals(list.get(i-1))){
                x += 1;
            }
            else{
                break;
            }
        }
        System.out.println(2 * Math.min(x, l - x));
    }
} Main
import java.util.*;
import java.util.Collections;
import java.util.ArrayList;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        String S = sc.next();
        int l = S.length();
        ArrayList<String> list = new ArrayList<String>();

        for(int i=0; i<l; i++){
            list.add(String.valueOf(S.charAt(i)));
        }

        Collections.sort(list);
        int x = 1;
        for(int i=1; i<l; i++){
            if(list.get(i).equals(list.get(i-1))){
                x += 1;
            }
            else{
                break;
            }
        }
        System.out.println(2 * Math.min(x, l - x));
    }
}