import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = getLine >>= print . solve

solve :: String -> Int 
solve = count 0 0 
    where
        count acc c (x : xs)
            | x `elem` "ACGT" = count acc (c + 1) xs
            | otherwise = count (max acc c) 0 xs
        count acc c _ = max acc c
        

readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine