import sys input = lambda: sys.stdin.readline().rstrip() # ----------------------- # n = int(input()) s = input() st = {'A','C','T','G'} ans = 0 for i,c in enumerate(s): if c in st: ans = i+1 print(ans)