(RankList for this Question)
Deepali loves ice cream so her mom bought her some amount of ice cream cups. She bought two flavours of ice cream, mint chocolate chip and cookie cream. These cups were arranged in a randomized order. If she wanted to, Deepali could eat all of them at the same time but her mom set a condition for her. Her mom will keep some of these cups in different boxes, each box can store exactly 3 cups neither less nor more and all 3 cups should not be of the same flavour. From all the cups, she will take all consecutive cups such that without changing their order she could store them in different boxes. She will take the most number of cups that she can to prevent Deepali from eating all of them. Find out how many cups will Deepali be able to eat.
\(0 \leq \) number of icecream cups Deepali can eat \(\leq 1000\)
The first and only line contains a string denoting the order in which the different ice cream cups are placed. M denotes mint chocolate chip and C denotes cookie cream.
Print the number of ice cream cups that Deepali would be able to eat after her mom stores some of them in the boxes.
The mom will take MMCMCC, she will store MMC in one box and MCC in the second box. So Deepali is left with 3 chocolates.
The mom will take all the chocolates, she will store MMC in the first box, CMM in the second box and MCM in the third box. So Deepali cannot eat any chocolates.
Log In to solve the Question