Forethought Future Cup - Elimination Round
B
Hate "A"
Codeforces
1100
原题
← AC →
翻译中…

Bob has a string $s$ consisting of lowercase English letters. He defines $s'$ to be the string after removing all "a" characters from $s$ (keeping all other characters in the same order). He then generates a new string $t$ by concatenating $s$ and $s'$. In other words, $t=s+s'$ (look at notes for an example).

翻译中…

You are given a string $t$. Your task is to find some $s$ that Bob could have used to generate $t$. It can be shown that if an answer exists, it will be unique.

翻译中…

Input

翻译中…

The first line of input contains a string $t$ ($1 \leq |t| \leq 10^5$) consisting of lowercase English letters.

翻译中…

Output

翻译中…

Print a string $s$ that could have generated $t$. It can be shown if an answer exists, it is unique. If no string exists, print ":(" (without double quotes, there is no space between the characters).

翻译中…

Note

翻译中…

In the first example, we have $s = $ "aaaaa", and $s' = $ "``".

翻译中…

In the second example, no such $s$ can work that will generate the given $t$.

翻译中…

In the third example, we have $s = $ "ababacac", and $s' = $ "bbcc", and $t = s + s' = $ "ababacacbbcc".

翻译中…

样例

Input #1
aaaaa
Output #1
aaaaa
InputCopy OutputCopy
Input #2
aacaababc
Output #2
:(
InputCopy OutputCopy
Input #3
ababacacbbcc
Output #3
ababacac
InputCopy OutputCopy
Input #4
baba
Output #4
:(
InputCopy OutputCopy
题目信息
题号
1146B
时间限制
1 s
内存限制
256 MB
标签
模拟
字符串

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。