give string s consist character b c you ask apply follow algorithm string number timespick nonempty prefix string s character prefix equalPick nonempty suffix string s character suffix equalthe prefix suffix intersect indexThe character prefix suffix samedelete prefix suffixreturn minimum length s perform operation number time possibly zero time Example 1input s caoutput 2explanation you can not remove character string stay isexample 2input s cabaabacoutput 0explanation an optimal sequence operation take prefix c suffix c remove s abaaba take prefix suffix remove s baab Take prefix b suffix b remove s aa take prefix suffix remove s example 3input s aabccabbaOutput 3explanation an optimal sequence operation take prefix aa suffix remove s bccabb take prefix b suffix bb remove s cca Constraints1 slength 105s consist character b c