from collections import Counter


def main():
    s = list(input())
    Count = Counter(s)
    if "0" not in s or "1" not in s:
        ans = 0
        print(ans)
        exit()
    min_key = min(Count, key=Count.get)
    ans = Count[min_key] * 2
    print(ans)


if __name__ == "__main__":
    main() from collections import Counter def main():
    s = list(input())
    Count = Counter(s)
    if "0" not in s or "1" not in s:
        ans = 0
        print(ans)
        exit()
    min_key = min(Count, key=Count.get)
    ans = Count[min_key] * 2
    print(ans) main s = list(input()) s list(input()) list input() input Count = Counter(s) Count Counter(s) Counter s if "0" not in s or "1" not in s:
        ans = 0
        print(ans)
        exit()
     "0" not in s or "1" not in s "0" not in s "0" s "1" not in s "1" s ans = 0 ans 0 print(ans) print ans exit() exit min_key = min(Count, key=Count.get) min_key min(Count, key=Count.get) min Count key=Count.get key Count.get Count get ans = Count[min_key] * 2 ans Count[min_key] * 2 Count[min_key] Count min_key 2 print(ans) print ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    s = list(input())
    Count = Counter(s)
    if "0" not in s or "1" not in s:
        ans = 0
        print(ans)
        exit()
    min_key = min(Count, key=Count.get)
    ans = Count[min_key] * 2
    print(ans) def main():
    s = list(input())
    Count = Counter(s)
    if "0" not in s or "1" not in s:
        ans = 0
        print(ans)
        exit()
    min_key = min(Count, key=Count.get)
    ans = Count[min_key] * 2
    print(ans) main
from collections import Counter


def main():
    s = list(input())
    Count = Counter(s)
    if "0" not in s or "1" not in s:
        ans = 0
        print(ans)
        exit()
    min_key = min(Count, key=Count.get)
    ans = Count[min_key] * 2
    print(ans)


if __name__ == "__main__":
    main()
