{"problem":{"name":"C. Smiley Faces (C)","description":{"content":"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 smil","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10140C"},"statements":[{"statement_type":"Markdown","content":"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?\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 achieve by mirroring exactly one substring.\n\n## Input\n\nThe input contains a non-empty string of no more than 2 × 105 characters. Each character is either ':', '(', or ')'.\n\n## Output\n\nPrint the maximum number of smiley faces Mr. Light can achieve by mirroring exactly one substring.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ s \\in \\{':', '(', ')'\\}^* $ be the input string of length $ n \\leq 2 \\times 10^5 $.  \nA *smiley face* is a substring `\":)\"`.  \nLet $ \\text{count}(s) $ denote the number of occurrences of `\":)\"` in $ s $.  \n\n**Operation**  \nFor any substring $ s[i:j] $ (inclusive indices, $ 1 \\leq i \\leq j \\leq n $), define its *mirror* as the reversed substring:  \n$ \\text{mirror}(s[i:j]) = s[j]s[j-1]\\dots s[i] $.  \nLet $ s' $ be the string obtained by replacing $ s[i:j] $ with $ \\text{mirror}(s[i:j]) $.  \n\n**Objective**  \nMaximize $ \\text{count}(s') $ over all possible choices of substring $ s[i:j] $ to mirror:  \n$$\n\\max_{1 \\leq i \\leq j \\leq n} \\text{count}\\left( s[1:i-1] + \\text{mirror}(s[i:j]) + s[j+1:n] \\right)\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10140C","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}