{"raw_statement":[{"iden":"problem statement","content":"Snuke can change a string $t$ of length $N$ into a string $t'$ of length $N - 1$ under the following rule:\n\n*   For each $i$ ($1 ≤ i ≤ N - 1$), the $i$\\-th character of $t'$ must be either the $i$\\-th or $(i + 1)$\\-th character of $t$.\n\nThere is a string $s$ consisting of lowercase English letters. Snuke's objective is to apply the above operation to $s$ repeatedly so that all the characters in $s$ are the same. Find the minimum necessary number of operations."},{"iden":"constraints","content":"*   $1 ≤ |s| ≤ 100$\n*   $s$ consists of lowercase English letters."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$s$"},{"iden":"sample input 1","content":"serval"},{"iden":"sample output 1","content":"3\n\nOne solution is: `serval` → `srvvl` → `svvv` → `vvv`."},{"iden":"sample input 2","content":"jackal"},{"iden":"sample output 2","content":"2\n\nOne solution is: `jackal` → `aacaa` → `aaaa`."},{"iden":"sample input 3","content":"zzz"},{"iden":"sample output 3","content":"0\n\nAll the characters in $s$ are the same from the beginning."},{"iden":"sample input 4","content":"whbrjpjyhsrywlqjxdbrbaomnw"},{"iden":"sample output 4","content":"8\n\nIn $8$ operations, he can change $s$ to `rrrrrrrrrrrrrrrrrr`."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}