14266 - Feed the Young Master   

Description

Jameson loves to eat cakes from "Feed the Young Master (餵公子吃餅)" since the cakes give him wings. Nevertheless, the cakes bring side effects such as being prone to colds and insomnia.

The cakes come in 26 flavors (a-z). A package of cakes can have a random number of each flavor. Also, the arrangement of cakes in a package is random.

Today, Jameson wants to have some cakes before he sleeps. To avoid eating too much, he will only pick consecutive cakes with the same flavors. However, since he loves the cakes too much, he allowed himself to swap two cakes before picking consecutive same-flavor cakes.

Please help Jameson to find out the maximum number of cakes he can eat.

  • This is a partial judge problem. You don't need to handle input and output. All you have to do is to implement the function int solve(std::string &text).
  • This is a work of fiction. Any resemblance to actual persons, living or dead, or actual events is purely coincidental.

Input

Input contains one line with a string text, the arrangement of cakes.

Constraints

  • 1 <= text.length <= 105
  • text consist of lowercase English characters only.

Output

Output contains one line with an integer, the maximum number of cakes Jameson can eat.

Sample Input  Download

Sample Output  Download

Partial Judge Code

14266.cpp

Partial Judge Header

14266.h

Tags




Discuss