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.Linq;
using System.IO;
using System.Collections.Generic;
using System.Text;

namespace AtCoder {
    public class Program {
        static int[] getKeys(char delimiter = ' ') {
            var Keys = Console.ReadLine().Split(delimiter);
            int N = Keys.Length;
            int[] Ns = new int[N];
            for (int i = 0; i < N; i++) {
                Ns[i] = int.Parse(Keys[i]);
            }
            return Ns;
        }
        static long[] getKeys_L(char delimiter = ' ') {
            var Keys = Console.ReadLine().Split(delimiter);
            int N = Keys.Length;
            long[] Ns = new long[N];
            for (int i = 0; i < N; i++) {
                Ns[i] = long.Parse(Keys[i]);
            }
            return Ns;
        }
        static double[] getKeys_D(char delimiter = ' ') {
            var Keys = Console.ReadLine().Split(delimiter);
            int N = Keys.Length;
            var Ns = new double[N];
            for (int i = 0; i < N; i++) {
                Ns[i] = double.Parse(Keys[i]);
            }
            return Ns;
        }
        static int[] getLines(int N, char delimiter = ' ') {
            int[] Ns = new int[N];
            for (int i = 0; i < N; i++) {
                Ns[i] = int.Parse(Console.ReadLine());
            }
            return Ns;
        }
        static long[] getLines_L(int N, char delimiter = ' ') {
            long[] Ns = new long[N];
            for (int i = 0; i < N; i++) {
                Ns[i] = long.Parse(Console.ReadLine());
            }
            return Ns;
        }
        static double[] getLines_D(int N, char delimiter = ' ') {
            double[] Ns = new double[N];
            for (int i = 0; i < N; i++) {
                Ns[i] = double.Parse(Console.ReadLine());
            }
            return Ns;
        }

        public static void Show<T>(T[,] map, string delimiter=" ") {
            int H = map.GetLength(0);
            int W = map.GetLength(1);
            Console.WriteLine("-------------------------");
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    Console.Write(map[i, j] + delimiter);
                }
                Console.WriteLine();
            }
            Console.WriteLine("-------------------------");
        }
        public static void Show<T>(IEnumerable<T> ts, string delimiter=" ") {
            foreach (var item in ts) {
                Console.Write(item + delimiter);
            }
            Console.WriteLine();
        }
        public static void ShowDictionary<T1, T2>(Dictionary<T1, T2> dictionary) {
            foreach (var item in dictionary) {
                Console.WriteLine(item);
            }
        }
        static T[] getUniform<T>(int length, T value) {
            T[] Ts = new T[length];
            for (int i = 0; i < length; i++) {
                Ts[i] = value;
            }
            return Ts;
        }
        static void setUniform<T>(T[] ts, T value) {
            int length = ts.Length;
            for (int i = 0; i < length; i++) {
                ts[i] = value;
            }
        }
        static T[,] getUniform_Diag<T>(int row, int col, T value, T defaultValue = default(T)) {
            T[,] Ts = new T[row, col];
            for (int i = 0; i < row; i++) {
                for (int j = 0; j < col; j++) {
                    Ts[j, i] = i == j ? defaultValue : value;
                }
            }
            return Ts;
        }
        static T[,] getUniform<T>(int row, int col, T value) {
            T[,] Ts = new T[row, col];
            for (int i = 0; i < row; i++) {
                for (int j = 0; j < col; j++) {
                    Ts[j, i] = value;
                }
            }
            return Ts;
        }
        static void setUniform<T>(T[,] ts, T value) {
            int N = ts.GetLength(0);
            int M = ts.GetLength(1);
            for (int i = 0; i < M; i++) {
                for (int j = 0; j < N; j++) {
                    ts[j, i] = value;
                }
            }
        }
        static void setUniform_Diag<T>(T[,] ts, T value, T defaultValue = default(T)) {
            int N = ts.GetLength(0);
            int M = ts.GetLength(1);
            for (int i = 0; i < M; i++) {
                for (int j = 0; j < N; j++) {
                    ts[j, i] = i == j ? defaultValue : value;
                }
            }
        }
        static Tuple<int, int> findIndex<T>(T[,] map, T value) where T : IComparable {
            int row = map.GetLength(0);
            int col = map.GetLength(1);
            for (int i = 0; i < col; i++) {
                for (int j = 0; j < row; j++) {
                    if (value.CompareTo(map[j, i]) == 0) return new Tuple<int, int>(j, i);
                }
            }
            return new Tuple<int, int>(-1, -1);
        }

        static void Main() {
            var code = Console.ReadLine();
            var Keys = new char[] { 'A', 'T', 'C', 'G' };
            var max = 0;
            for (int i = 0; i < code.Length; i++) {
                if (Keys.Contains(code[i])) {
                    int count = 0;
                    while (i < code.Length && Keys.Contains(code[i])) {
                        count++;
                        i++;
                    }
                    max = Math.Max(max, count);
                    i--;
                }
            }
            Console.WriteLine(max);
        }
    }
}