2017 PSUT Coding Marathon |
---|
Finished |
Mr. Light is not satisfied with the number of smiley faces in his string. Now he wants to mirror exactly one substring (one or more consecutive characters in the string) to increase the number of smiley faces as possible. Can you find the maximum number of smiley faces he can achieve?
The input contains a non-empty string of no more than 2 × 105 characters. Each character is either ':', '(', or ')'.
Print the maximum number of smiley faces Mr. Light can achieve by mirroring exactly one substring.
:(:):(:):)
4
:)::(:(:
3
Name |
---|