Problem:
Score : 200 points

Problem Statement

You are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.

Here, a ACGT string is a string that contains no characters other than A, C, G and T.

Notes

A substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.

For example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.

Constraints

S is a string of length between 1 and 10 (inclusive).

Each character in S is an uppercase English letter.

Input

Input is given from Standard Input in the following format:

S

Output

Print the length of the longest ACGT string that is a substring of S.

Sample Input 1

ATCODER

Sample Output 1

3

Among the ACGT strings that are substrings of ATCODER, the longest one is ATC.

Sample Input 2

HATAGAYA

Sample Output 2

5

Among the ACGT strings that are substrings of HATAGAYA, the longest one is ATAGA.

Sample Input 3

SHINJUKU

Sample Output 3

0

Among the ACGT strings that are substrings of SHINJUKU, the longest one is (the empty string).

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AIZUproject08
{
    //128B
    /*class Data
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public int Evaluation { get; set; }
    }
    class Program
    {
        static void Main()
        {
            List<Data> datalist = new List<Data>();
            Data data;
            int N = int.Parse(Console.ReadLine());
            for (int i=0;i< N;i++)
            {
                var temp = Console.ReadLine().Split(' ');
                data = new Data();
                data.ID = i + 1;
                data.Name = temp[0];
                data.Evaluation = int.Parse(temp[1]);
                datalist.Add(data);
            }
            datalist = datalist.OrderBy(n => n.Name).ThenByDescending(n => n.Evaluation).ToList();
            foreach (var ans in datalist)
            {
                Console.WriteLine(ans.ID);
            }
        }
    }*/
    //127B
    /*class Program
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int r = input[0];
            int D = input[1];
            int X = input[2];
            for (int i=0;i<10;i++)
            {
                var ans = r * X - D;
                Console.WriteLine(ans);
                X = ans;
            }
        }
    }*/
    //126B
    /*class Program
    {
        static void Main()
        {
            List<int> mae = new List<int>();
            List<int> ushiro = new List<int>();
            string input = Console.ReadLine();
            var rabel = "NA";
            for (int i = 0; i < 2; i++)
            {
                char moji = input[i];
                mae.Add(int.Parse(string.Join("",moji)));
            }
            for (int i = 2; i < 4; i++)
            {
                char moji = input[i];
                ushiro.Add(int.Parse(string.Join("", moji)));
            }
            int A = 10 * mae[0] + 1 * mae[1];
            int B = 10 * ushiro[0] + 1 * ushiro[1];

            if (0 <= A && A <= 99 && 0 < B && B < 13)
            {
                rabel = "YYMM";
                if (0 < A && A < 13 && 0 < B && B < 13)
                {
                    rabel = "AMBIGUOUS";
                }
            }
            else if (0 <= B && B <= 99 && 0 < A && A < 13)
            {
                 rabel = "MMYY";
                if (0 < A && A < 13 && 0 < B && B < 13)
                {
                    rabel = "AMBIGUOUS";
                }
            }
            Console.WriteLine(rabel);
        }
    }*/
    //125B
    /*class Program
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            int[] V = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] C = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int Answer = 0;
            for (int i=0;i<N;i++)
            {
                var temp = V[i] - C[i];
                if (temp > 0)
                {
                    Answer += temp;
                }
            }
            
            Console.WriteLine(Answer);
        }
    }*/
    //124B
    //count変数の初期化忘れがち!!
    /*class Program
    {
        static void Main()
        {
            int Ans = 0;
            int count = 0;
            int N = int.Parse(Console.ReadLine());
            int[] Height = Console.ReadLine().Split().Select(int.Parse).ToArray();
            for (int i =0;i<Height.Length;i++)
            {
                for (int j=0;j<i;j++)
                {
                    if (Height[i] >= Height[j])
                    {
                        Ans++;
                    }
                }
                if (Ans == i)
                {
                    count++;
                }
                Ans = 0;
            }
            Console.WriteLine(count);
        }
    }*/
    //123B
    /*class Program
    {
        static void Main()
        {
            List<int> time = new List<int>();
            List<int> sample = new List<int>();
            int[] aa = new int[5];
            for (int i = 0;i<5;i++)
            {
                int dish = int.Parse(Console.ReadLine());
                time.Add(dish);
            }
            time.CopyTo(aa);
            int ans = 0;
            foreach (int a in time)
            {
                var temp = a % 10;
                sample.Add(temp);
            }
            var jj = sample.IndexOf(sample.Min());
            time.RemoveAt(jj);
            time.Add(aa[jj]);

            foreach (int n in time)
            {
                ans += n;
                if (ans % 10 != 0)
                {
                    ans += 10 - (ans % 10);
                }
            }
            Console.WriteLine(ans);
        }
    }*/
    //122B
    class Program
    {
        static void Main()
        {
            int anscount = 0;
            List<int> Answer = new List<int>();
            string S = Console.ReadLine();
            char[] Cstr = new char[S.Length];
            for (int i=0;i<S.Length;i++)
            {
                Cstr[i] = S[i];
            }
            for (int i=0;i<Cstr.Length;i++)
            {
                var temp = i;
                while (true)
                {
                    if (temp < Cstr.Length)
                    {
                        if (Cstr[temp] == 'A' || Cstr[temp] == 'C' || Cstr[temp] == 'G' || Cstr[temp] == 'T')
                        {
                            anscount++;
                            temp++;
                        }
                        else
                        {
                            Answer.Add(anscount);
                            anscount = 0;
                            break;
                        }
                    }
                    else
                    {
                        Answer.Add(anscount);
                        anscount = 0;
                        break;
                    }
                }
            }
            Console.WriteLine(Answer.Max());
        }
    }
}