from collections import Counter
S = str(input())
c = Counter(S)
d = c.most_common()
if len(d) == 2:
  ans = d[1][1] * 2
  print(ans)
else:
  print(0) from collections import Counter S = str(input()) S str(input()) str input() input c = Counter(S) c Counter(S) Counter S d = c.most_common() d c.most_common() c.most_common c most_common if len(d) == 2:
  ans = d[1][1] * 2
  print(ans)
else:
  print(0) len(d) == 2 len(d) len d 2 ans = d[1][1] * 2 ans d[1][1] * 2 d[1][1] [1] d 1 1 2 print(ans) print ans print(0) print 0 c = Counter(S) Counter(S) c ans = d[1][1] * 2 d[1][1] * 2 ans d = c.most_common() c.most_common() d S = str(input()) str(input()) S
from collections import Counter
S = str(input())
c = Counter(S)
d = c.most_common()
if len(d) == 2:
  ans = d[1][1] * 2
  print(ans)
else:
  print(0)