you give string s consist lowercase english letter in operation candelete entire string s orDelete letter s letter s equal follow letter s range 1 slength 2for example s ababc operation delete letter s abc letter s follow letter s equal abreturn maximum number operation need delete s Example 1input s abcabcdabcoutput 2explanation Delete 3 letter abc 3 letter equal now s abcdabc Delete lettersWe 2 operation return 2 it prove 2 maximum number operation needednote second operation delete abc occurrence abc happen 3 lettersexample 2input s aaabaabOutput 4explanation Delete letter letter equal now s aabaab Delete 3 letter aab 3 letter equal now s aab Delete letter letter equal now s ab Delete lettersWe 4 operation return 4 it prove 4 maximum number operation neededExample 3input s aaaaaoutput 5explanation in operation delete letter s Constraints1 slength 4000s consists lowercase english letter