from collections import Counter
s = input()
S = [int(x) for x in list(str(s))]
if sum(S) == 0 or sum(S) == len(S)*1:
    print(0)
else:
    cnt = Counter(s)
    v = cnt.values()

    print(min(v)*2)
 from collections import Counter s = input() s input() input int(x) for x in list(str(s)) for x in list(str(s)) x list(str(s)) list str(s) str s for x in list(str(s)) int(x) int x S = [int(x) for x in list(str(s))] S [int(x) for x in list(str(s))] if sum(S) == 0 or sum(S) == len(S)*1:
    print(0)
else:
    cnt = Counter(s)
    v = cnt.values()

    print(min(v)*2) sum(S) == 0 or sum(S) == len(S)*1 sum(S) == 0 sum(S) sum S 0 sum(S) == len(S)*1 sum(S) sum S len(S)*1 len(S) len S 1 print(0) print 0 cnt = Counter(s) cnt Counter(s) Counter s v = cnt.values() v cnt.values() cnt.values cnt values print(min(v)*2) print min(v)*2 min(v) min v 2 cnt = Counter(s) Counter(s) cnt s = input() input() s S = [int(x) for x in list(str(s))] [int(x) for x in list(str(s))] S v = cnt.values() cnt.values() v
from collections import Counter
s = input()
S = [int(x) for x in list(str(s))]
if sum(S) == 0 or sum(S) == len(S)*1:
    print(0)
else:
    cnt = Counter(s)
    v = cnt.values()

    print(min(v)*2)

