404039: GYM101401 C Smiley Faces (C)

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

C. Smiley Faces (C)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

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?

Input

The input contains a non-empty string of no more than 2 × 105 characters. Each character is either ':', '(', or ')'.

Output

Print the maximum number of smiley faces Mr. Light can achieve by mirroring exactly one substring.

ExamplesInput
:(:):(:):)
Output
4
Input
:)::(:(:
Output
3

加入题单

算法标签: