import collections
n=str(input())
lst=list(collections.Counter(n).most_common())
if len(lst)==1:
  print(0)
else:
  print(lst[1][1]*2) import collections collections n=str(input()) n str(input()) str input() input lst=list(collections.Counter(n).most_common()) lst list(collections.Counter(n).most_common()) list collections.Counter(n).most_common() collections.Counter(n).most_common collections.Counter(n) collections.Counter collections Counter n most_common if len(lst)==1:
  print(0)
else:
  print(lst[1][1]*2) len(lst)==1 len(lst) len lst 1 print(0) print 0 print(lst[1][1]*2) print lst[1][1]*2 lst[1][1] [1] lst 1 1 2 lst=list(collections.Counter(n).most_common()) list(collections.Counter(n).most_common()) lst n=str(input()) str(input()) n
import collections
n=str(input())
lst=list(collections.Counter(n).most_common())
if len(lst)==1:
  print(0)
else:
  print(lst[1][1]*2)