All submissions for this problem are available.Mycroft has been taken hostage by Moriarty . To rescue Mycroft, Sherlock needs to solve Moriarty's final puzzle. Sherlock is having trouble solving the problem and asks you to help him. Now to solve the puzzle, he needs to extract a magic number out of a given string. The string contains lower case latin characters. The magic number can be calculated as the maximum distance between two opposite characters. Two characters are called opposite if thier sum of indexes in the latin alphabets is $27$ . . Opposite of $a$ is $z$ and vice versa. Opposite of $b$ is $y$ and vice versa and so on.. ###Input: - First line will contain $T$, number of testcases. Then the testcases follow. - Each testcase contains of a single line of input, a string $S$. ###Output: For each testcase, output in a single line, the magic number to that string. ###Constraints - $1 \leq T \leq 1000$ - $2 \leq |S| \leq 1000$ The sum of |S| over all test cases is $\leq 1000000$ $|M|$ denotes the length of string. ###Sample Input: $2$ $abzyz$ $abcdzyxw$ ###Sample Output: $4$ $4$ ###EXPLANATION: In the first example maximum distance $4$ is between $a$ and $z$. In the second example all pairs of opposite characters have the same distance i.e. $4$.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, COB, FS|
Fetching successful submissions