Some terrorist attacks on Indian border. Now Indian Army have to send his soldiers to fight against terrorist. There are total N soldiers in the camp. Every soldier has a skill denoted by a single character lies between A-Z (all skills are in CAPITAL LETTERS). Now commander gave order to stand all the soldiers in a row, so that he can select a segment of maximum number of soldiers from the row to sent them for fighting against the terrorist.

INPUT

First line contains number of test cases T, for each test case a single line represents soldiers standing in a row with their skill.

OUTPUT

A single line representing maximum number of soldiers that commander selects for each test case.

Constraints:

1 ≤ T ≤100

1 ≤ N ≤ 10000

SAMPLE INPUT
2
ABDEFGABEF
GHJKLMNOPQ

SAMPLE OUTPUT
6
10

Explanation

For first test case, the soldier skills are “ABDEFGABEF” maximum soldiers with different skills are “ABDEFG” and “BDEFGA”, "DEFGAB" with length 6.
def maxselect():
    for test in range(input()):
        force = [i for i in raw_input()]
        flen = len(force)
        i = 0
        j = 0
        ldir = {i: 0 for i in "ABCDEFGHIJKLMNOPQRSTUVWXYZ"}
        countlst = []
        while i < flen and j <= flen:
            if j < flen and ldir.get(force[j]) == 0:
                ldir[force[j]] = 1
                j += 1
            else:
                countlst.append(abs(j - i))
                ldir = {i: 0 for i in "ABCDEFGHIJKLMNOPQRSTUVWXYZ"}
                i += 1
                j = i
        print max(countlst)
maxselect()