{"raw_statement":[{"iden":"statement","content":"Mr. Light now have a string that consists only of the three characters: ':', '(', and ')'.\n\nMr. Light considers a colon ‘:’ followed by a closing bracket ')' as a smiley face. So \":)\" is a smiley face while \"(:\" is not. Now he wants to choose exactly one prefix (one or more characters at the beginning) of this string and mirror it (reverse it and flip the brackets).\n\nFor example, the string \":):((\" mirrored is \")):(:\". \n\nWhat is the maximum number of smiley faces Mr. Light can get in the string after mirroring exactly one prefix?\n\nThe input contains a non-empty string of no more than 2 × 105 characters. Each character is either ':', '(', or ')'.\n\nPrint the maximum number of smiley faces Mr. Light can get after mirroring exactly one prefix.\n\n"},{"iden":"input","content":"The input contains a non-empty string of no more than 2 × 105 characters. Each character is either ':', '(', or ')'."},{"iden":"output","content":"Print the maximum number of smiley faces Mr. Light can get after mirroring exactly one prefix."},{"iden":"examples","content":"Input:(:):(:):)Output4Input:)::(:(:Output2"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ s \\in \\{':', '(', ')'\\}^* $ be the input string of length $ n $.  \nLet $ \\text{smiley}(s) $ denote the number of occurrences of the substring \":)\" in $ s $.  \n\nFor any prefix length $ k \\in \\{1, 2, \\dots, n\\} $, define the operation $ M_k(s) $:  \n- Mirror the prefix $ s[1..k] $: reverse it and flip each bracket:  \n  - $ '(' \\leftrightarrow ')' $,  \n  - $ ':' $ remains unchanged.  \n- Let $ s'_k = M_k(s) $ be the resulting string.  \n\n**Constraints**  \n$ 1 \\leq n \\leq 2 \\times 10^5 $\n\n**Objective**  \nMaximize the number of smiley faces:  \n$$\n\\max_{k \\in \\{1, \\dots, n\\}} \\text{smiley}(s'_k)\n$$","simple_statement":"Given a string of ':', '(', and ')', you can choose one prefix, reverse it, and flip '(' to ')' and ')' to '('. Find the maximum number of \":)\" smileys possible after doing this exactly once.","has_page_source":false}