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).


-----Examples-----
Input
aaaaa

Output
aaaaa

Input
aacaababc

Output
:(

Input
ababacacbbcc

Output
ababacac

Input
baba

Output
:(



-----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".

Difficulty: EASY

Solutions:
t = input()
done = False
removed = t.replace('a', '')
s = removed[len(removed) // 2:]
if s * 2 == removed and s == t[len(t) - len(s):]:
	print(t[:len(t) - len(s)])
else:
	print(':(')


ch = input()
s = ''
k = ''
for i in range(len(ch)):
	if ch[i] != 'a':
		s = s + ch[i]
test = True
if len(s) % 2 == 1:
	print(':(')
else:
	for i in range(len(s) // 2):
		test = test and s[i] == s[i + len(s) // 2]
		test = test and s[i] == ch[len(ch) - len(s) // 2 + i]
	if test:
		for i in range(len(ch) - len(s) // 2):
			k = k + ch[i]
	else:
		print(':(')
print(k)


def mp():
	return map(int, input().split())
t = input()
s = []
n = 0
for i in range(len(t)):
	if t[i] == 'a':
		n = i
for i in range(n + 1):
	if t[i] != 'a':
		s.append(t[i])
ss = t[n + 1:]
x = (len(ss) - len(s)) // 2
s = ''.join(s) + t[n + 1:n + x + 1]
ss = t[n + x + 1:]
if s == ss and (t.count('a') > 0 or len(t) % 2 == 0):
	print(t[:n + x + 1])
else:
	print(':(')


t = input()
countOfAs = t.count('a')
if (len(t) + countOfAs) % 2:
	print(':(')
else:
	lenOfS = int((len(t) + countOfAs) / 2)
	if t[:lenOfS].replace('a', '') == t[lenOfS:]:
		print(t[:lenOfS])
	else:
		print(':(')


a = input()
b = a.replace('a', '')
k = len(b)
a1 = a[::-1]
z = a1[:k // 2][::-1]
if k & 1:
	exit(print(':('))
for i in range(k // 2):
	if b[i] != z[i]:
		exit(print(':('))
for i in range(len(a) - k // 2):
	print(a[i], end='')


from collections import Counter
s = input()
c = Counter(s)
l = (len(s) + c['a']) // 2
if s[:l].replace('a', '') == s[l:]:
	print(s[:l])
else:
	print(':(')


t = input()
n = len(t)
last = -1
pre = []
cur = []
for i in range(n):
	if t[i] == 'a':
		last = i
		pre.extend(cur)
		cur = []
	else:
		cur.append(t[i])
pre = ''.join(pre)
(u, v) = (pre, t[last + 1:])
res = u + v
if len(v) >= len(u) and len(res) % 2 == 0 and (res[:len(res) // 2] == res[len(res) // 2:]):
	rem = len(res) // 2 - len(pre)
	print(t[:last + 1] + t[last + 1:last + 1 + rem])
else:
	print(':(')


s = input()
str1 = ''
str2 = ''
flag = 0
n = len(s)
for i in range(n):
	str1 += s[i]
	if s[i] != 'a':
		str2 += s[i]
	if str1 + str2 == s:
		flag = 1
		break
if flag == 0:
	print(':(')
else:
	print(str1)


from collections import defaultdict
import string
t = input()
tdash = t.replace('a', '')
ans = ':('
if not tdash:
	ans = t
if not len(tdash) % 2:
	mid = len(tdash) // 2
	if tdash[:mid] == tdash[mid:] and 'a' not in t[-mid:]:
		ans = t[:-mid]
print(ans)


t = input()
t2 = [x for x in t if x != 'a']
l = len(t2) // 2
if len(t2) & 1:
	print(':(')
	exit()
for i in range(l):
	if t2[i] != t2[i + l]:
		print(':(')
		exit()
i = 0
for s in t:
	if s != 'a':
		i += 1
	elif i > l:
		print(':(')
		exit()
print(''.join(t[:len(t) - l]))


from queue import Queue
line = input()
dic = {}
arr = []
last = -1
q = Queue()
c = 0
s = []
for i in range(0, len(line)):
	s.append(line[i])
	if line[i] == 'a':
		c += 1
		last = i
	else:
		arr.append(line[i])
		dic[line[i]] = i
if len(arr) % 2 != 0:
	print(':(')
else:
	X = False
	temp1 = arr[0:int(len(arr) / 2)]
	temp2 = arr[int(len(arr) / 2):len(arr)]
	flag3 = False
	lst = 0
	for (x, y) in list(zip(temp1, temp2)):
		if not flag3:
			flag3 = True
			lst = dic[y]
		if x != y:
			print(':(')
			X = True
			break
		if dic[y] <= last:
			print(':(')
			X = True
			break
	if not X:
		for p in range(0, int((len(s) - c) / 2 + c)):
			print(s[p], end='')


t = input()
n = len(t)
l = n - (n - t.count('a')) // 2
print((':(', t[:l])[t[:l].replace('a', '') == t[l:]])


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
ins = RW()
a_cnt = ins.count('a')
len2 = (len(ins) - a_cnt) // 2
len1 = len(ins) - len2
if ins[:len1].replace('a', '') == ins[len1:]:
	print(ins[:len1])
else:
	print(':(')


l = list(input())
ans = ''
for i in range(len(l)):
	if l[i] != 'a':
		ans += l[i]
if len(ans) == 0:
	print(''.join(l))
	exit()
n = len(l) - len(ans)
if ans[:len(ans) // 2] == ans[len(ans) // 2:] and 'a' not in l[n + len(ans) // 2:]:
	count = len(ans) // 2
	val = 0
	for i in range(len(l)):
		if val <= count:
			print(l[i], end='')
			if l[i] != 'a':
				val += 1
			if val == count and l[i + 1] != 'a':
				break
		else:
			break
else:
	print(':(')


t = input()
g = t.replace('a', '')
if g[:len(g) // 2] == t[len(t) - len(g) // 2:] and len(g) % 2 == 0:
	print(t[:len(t) - len(g) // 2])
else:
	print(':(')


t = input()
copy = t
t = t.replace('a', '')
if len(t) % 2 == 1:
	print(':(')
	exit(0)
d = int(len(t) / 2)
if t[d:] != copy[len(copy) - d:]:
	print(':(')
elif t[:d] == t[d:]:
	print(copy[:len(copy) - d])
else:
	print(':(')


s = input()
n = len(s)
s1 = s.replace('a', '')
if len(s1) % 2 != 0:
	print(':(')
else:
	k = len(s1) // 2
	s1 = s1[:k]
	if s[-k:] == s1 or k == 0:
		print(s[:n - k])
	else:
		print(':(')


t = input()
x = t.count('a')
if (len(t) + x) % 2 == 1:
	print(':(')
else:
	p = (len(t) + x) // 2
	ans = []
	for q in t[:p]:
		if q != 'a':
			ans.append(q)
	ans = ''.join(ans)
	if ans == t[p:]:
		print(t[:p])
	else:
		print(':(')


a = input()
b = a.replace('a', '')
l = len(b)
if l % 2 == 1:
	print(':(')
elif b[:int(l / 2)] == a[a.count('a') + int(l / 2):]:
	print(a[:a.count('a') + int(l / 2)])
else:
	print(':(')


n = str(input().strip())
j2 = list(n)
oc = len(j2) - j2.count('a')
if oc % 2 == 1:
	print(':(')
else:
	j = oc / 2
	i = 0
	spot = 0
	while (i < 1 or i < j) and spot < len(n):
		if j2[spot] != 'a':
			i += 1
		spot += 1
	while spot < len(n) and n[spot] == 'a':
		spot += 1
	s = n[0:spot]
	l = n[spot:]
	k = s.replace('a', '')
	if l == k:
		print(s)
	else:
		print(':(')


x = input()
numAs = x.count('a')
sLength = (len(x) - numAs) // 2 + numAs
s = x[:sLength]
sPrime = x[sLength:]
s = s.replace('a', '')
if s == sPrime:
	print(x[:sLength])
else:
	print(':(')


def solve():
	s = input()
	a = ''
	for x in s:
		if x != 'a':
			a += x
	if len(a) == 0:
		print(s)
		return
	n = len(a) // 2
	if 'a' in s[len(s) - n:]:
		print(':(')
		return
	print(s[:len(s) - n] if a[:n] == a[n:] else ':(')

def __starting_point():
	solve()
__starting_point()


s = input()
r = s.replace('a', '')
if r == 2 * r[:len(r) // 2] and (s[-len(r) // 2:].count('a') == 0 or r == ''):
	print(s[:len(s) - len(r) // 2])
else:
	print(':(')


t = input()
temp = t.replace('a', '')
if temp[:len(temp) // 2] != temp[len(temp) // 2:]:
	print(':(')
	exit()
print(':(' if 'a' in t[len(t) - len(temp) // 2:] else t[:len(t) - len(temp) // 2])


S = input()
A = 0
B = 0
for s in S:
	if s == 'a':
		A += 1
	else:
		B += 1
if B % 2:
	print(':(')
else:
	if B == 0:
		R = ''
		L = S
	else:
		R = S[-B // 2:]
		L = S[:-B // 2]
	L2 = []
	L3 = []
	for l in L:
		L3.append(l)
		if l != 'a':
			L2.append(l)
	if ''.join(L2) == R:
		print(''.join(L3))
	else:
		print(':(')


s = input()
n = len(s)
s2 = ''
flag = 0
for i in range(n):
	if s[i] != 'a':
		s2 = s2 + s[i]
	if s[0:i + 1] + s2 == s:
		print(s[0:i + 1])
		flag = 1
		break
if flag == 0:
	print(':(')


import bisect
s = input()
n = len(s)
if set(s) == {'a'}:
	print(s)
else:
	c = s.count('a')
	if c == 0:
		if len(s) % 2 == 0 and s[:n // 2] == s[n // 2:]:
			print(s[:n // 2])
		else:
			print(':(')
	else:
		s1 = str()
		s2 = str()
		c = -1
		for i in range(n - 1, -1, -1):
			if s[i] == 'a':
				c = i
				break
		for i in range(0, c + 1):
			if s[i] != 'a':
				s1 += s[i]
		s2 = s[c + 1:]
		if s1 == s2:
			print(s[:c + 1])
			exit()
		elif len(s1) == len(s2) and s1 != s2:
			print(':(')
			exit()
		elif len(s1) > len(s2):
			print(':(')
			exit()
		s3 = s1 + s2
		if len(s3) % 2 == 0 and s3[:len(s3) // 2] == s3[len(s3) // 2:]:
			k1 = len(s3) // 2 - len(s1)
			print(s[:c + k1 + 1])
		else:
			print(':(')


s = input()
n = (len(s) + s.count('a')) // 2
if s[n:] * 2 == s.replace('a', ''):
	print(s[:n])
else:
	print(':(')


s = input()
a = s.count('a')
l2 = (len(s) - a) // 2
l1 = len(s) - l2
if s[:l1].replace('a', '') == s[l1:]:
	print(s[:l1])
else:
	print(':(')


t = input()
(s, k) = ('', 0)
for (i, x) in enumerate(t):
	if x != 'a':
		s += x
	if s == t[i + 1:]:
		print(t[:i + 1])
		k = 1
		break
if k == 0:
	if s == '':
		print(t)
	else:
		print(':(')


import os

def _f(s):
	new_s = ''
	last_a_index = -1
	last_a_index_in_new_s = -1
	for (i, c) in enumerate(s):
		if c == 'a':
			last_a_index = i
			last_a_index_in_new_s = len(new_s)
		else:
			new_s += c
	if new_s == '':
		return s
	if last_a_index == -1:
		if s[len(s) // 2:] == s[:len(s) // 2]:
			return s[:len(s) // 2]
		else:
			return ':('
	last_a_index_in_new_s_save = last_a_index_in_new_s
	while last_a_index_in_new_s < len(new_s):
		if new_s[:last_a_index_in_new_s] == new_s[last_a_index_in_new_s:]:
			return s[:last_a_index + (last_a_index_in_new_s - last_a_index_in_new_s_save + 1)]
		last_a_index_in_new_s += 1
	return ':('

def f(s):
	return _f(s)
if os.environ.get('DEBUG', False):
	print(f"{f('aaaaa')} = aaaaa")
	print(f"{f('aacaababc')} = :(")
	print(f"{f('ababacacbbcc')} = ababacac")
	print(f"{f('baba')} = :(")
	print(f"{f('bbb')} = :(")
	print(f"{f('bbbb')} = bb")
	print(f"{f('acc')} = ac")
	print(f"{f('caa')} = :(")
	print(f"{f('b')} = :(")
	print(f"{f('bb')} = b")
	print(f"{f('a')} = a")
	print(f"{f('bbbc')} = :(")
	print(f"{f('cbcb')} = :(")
else:
	print(f(input()))


from collections import Counter as C
s = input()
c = C(s)
n = len(s)
a = c.get('a', 0)
m = n - a
if m & 1:
	print(':(')
	return
m //= 2
m += a
t = s[:m]
if t + ''.join((c for c in t if c != 'a')) != s:
	print(':(')
	return
print(t)


from copy import copy
import re
def_line = str(input())
line_copy = copy(def_line)
def_line = ''.join((x for x in def_line.split('a')))
l = len(def_line)
if l % 2 == 0 and def_line[0:l // 2] == def_line[l // 2:l] and (def_line[l // 2:l] == line_copy[len(line_copy) - l // 2:len(line_copy)]):
	print(line_copy[0:len(line_copy) - l // 2])
else:
	print(':(')


s = input()
k = set(s)
if len(k) == 1 and s[0] == 'a':
	print(s)
else:
	(c1, c2) = (0, 0)
	for i in s:
		if i == 'a':
			c1 += 1
		else:
			c2 += 1
	if c2 % 2 != 0:
		print(':(')
	else:
		k = c2 // 2
		f = s[-k:]
		z = ''
		n = len(s)
		for i in range(n - k):
			if s[i] != 'a':
				z += s[i]
		if f == z:
			print(s[:n - k])
		else:
			print(':(')


s = input().strip()
d = len(s)
e = ''
c_0 = 0
c_1 = 0
a = 0
for i in range(d):
	if s[i] == 'a':
		c_0 += 1
		a = i
	else:
		e += s[i]
		c_1 += 1
if c_1 % 2 != 0 or d - a <= c_1 // 2:
	print(':(')
elif c_1 == 0 and c_0 > 0:
	print(s)
else:
	half = c_1 // 2
	r1 = e[:half]
	r2 = e[half:]
	if r1 != r2:
		print(':(')
	else:
		print(s[:-half])


word = input()
new_word = [x for x in word if x != 'a']
if len(new_word) % 2 != 0:
	print(':(')
else:
	lnw2 = len(new_word) // 2
	first_half = ''.join(new_word[:lnw2])
	second_half = ''.join(new_word[-lnw2:])
	if first_half != second_half or second_half != ''.join([x for x in word[-lnw2:] if x != 'a']):
		print(':(')
	elif lnw2 == 0:
		print(word)
	else:
		print(word[:-lnw2])


line = input()
pure = line.replace('a', '')
if len(pure) % 2:
	print(':(')
	exit()
cnt = 0
half = pure[:len(pure) // 2]
if len(half) == 0:
	print(line)
	exit()
ii: int
for i in range(len(line)):
	c = line[i]
	if c != 'a':
		cnt += 1
		if cnt == len(half) + 1:
			ii = i
			break
enda = ii
while ii < len(line):
	if line[ii] == 'a':
		print(':(')
		exit()
	ii += 1
if half != pure[len(pure) // 2:]:
	print(':(')
else:
	print(line[:enda])


from collections import Counter
from bisect import bisect_right
t = str(input())
b = []
for i in t:
	if i != 'a':
		b.append(i)
b = ''.join(b)
n = len(b) // 2
if b[:n] == b[n:]:
	y = list(t)
	while n > 0:
		y.pop()
		n -= 1
	s = ''.join(y)
	if 'a' in t[len(y):]:
		print(':(')
		quit()
	print(s)
else:
	print(':(')


e = input()
f = [i for i in e if i != 'a']
n = len(f) // 2
n2 = len(e)
if f[:n] == f[n:] and 'a' not in e[n2 - n:]:
	print(e[:n2 - n])
else:
	print(':(')


s = input()
t = ''
t1 = ''
for (i, c) in enumerate(s):
	if c != 'a':
		t1 += c
	if s[i + 1:] == t1:
		print(s[:i + 1])
		exit(0)
print(':(')


s = input()
res = ''
for c in s:
	if c != 'a':
		res += c
n = len(res)
s1 = res[int(n / 2):]
n1 = len(s1)
if n1 == 0:
	ans = s
else:
	ans = s[:-n1] + s1
if ans == s:
	if n1 == 0:
		print(s)
	elif res[int(n / 2):] == res[:int(n / 2)]:
		print(s[:-n1])
	else:
		print(':(')
else:
	print(':(')


t = input()
len1 = len(t)
new = ''
for ch in t:
	if ch != 'a':
		new += ch
n = len(new)
if n % 2 != 0:
	print(':(')
else:
	half = n // 2
	s1 = new[:half]
	s2 = new[half:]
	if s1 != s2:
		print(':(')
	else:
		str = t[:len1 - half]
		s = ''
		for ch in str:
			if ch != 'a':
				s += ch
		new_str = str + s
		if t != new_str:
			print(':(')
		else:
			print(str)


s = input()
if 'a' in s:
	i = s.rindex('a')
	s2 = s[:i + 1]
	s1 = s2.replace('a', '')
	s = s[i + 1:]
	if len(s1) != 0 and s1 not in s:
		print(':(')
	elif len(s1) == 0:
		if len(s) % 2 != 0:
			print(':(')
		else:
			l1 = len(s) // 2
			if s[:l1] == s[l1:]:
				print(s2 + s[:l1])
			else:
				print(':(')
	else:
		j = s.index(s1)
		l = len(s1)
		if s1 == s:
			print(s2)
		elif s[:j] == s[j + l:]:
			print(s2 + s[:j])
		else:
			print(':(')
elif len(s) % 2 != 0:
	print(':(')
else:
	l1 = len(s) // 2
	if s[:l1] == s[l1:]:
		print(s[:l1])
	else:
		print(':(')


s = list(input().strip())
idx_a = -1
(d_list, d_idx) = ([], [])
for (i, elem) in enumerate(s):
	if elem == 'a':
		idx_a = i
	else:
		d_list.append(elem)
		d_idx.append(i)
if len(d_list) == 0:
	print(''.join(s))
elif d_list[:len(d_list) // 2] == d_list[len(d_list) // 2:]:
	if d_idx[len(d_list) // 2] < idx_a:
		print(':(')
	elif d_idx[len(d_list) // 2 - 1] < idx_a:
		print(''.join(s[:idx_a + 1]))
	else:
		print(''.join(s[:d_idx[len(d_idx) // 2]]))
else:
	print(':(')


def sv():
	T = input()
	TnoA = ''.join((c for c in T if c != 'a'))
	N = len(TnoA)
	if N == 0:
		print(T)
		return
	if N % 2 or T[-N // 2:] != TnoA[:N // 2]:
		print(':(')
		return
	print(T[:-N // 2])
	return
sv()


t = input()
n = len(t)
d_s1 = []
for c in t:
	if c != 'a':
		d_s1.append(c)
if len(d_s1) % 2 == 1 or (d_s1 and t[-1] == 'a'):
	print(':(')
else:
	n_s1 = len(d_s1) // 2
	if n_s1 and t[-n_s1:] != ''.join(d_s1[:n_s1]):
		print(':(')
	else:
		print(t[:n - n_s1])


s = input()
s1 = ''
for i in range(len(s)):
	if s[i] != 'a':
		s1 += s[i]
flag = 1
if len(s1) % 2 == 1:
	flag = 0
else:
	sd = s1[:len(s1) // 2]
	if sd != s1[len(s1) // 2:]:
		flag = 0
	elif sd != s[len(s) - len(s1) // 2:]:
		flag = 0
	else:
		s2 = s[:len(s) - len(s1) // 2]
		s3 = ''
		for i in range(len(s2)):
			if s2[i] != 'a':
				s3 += s2[i]
		if s3 == sd:
			ans = s2
		else:
			flag = 0
if flag == 0:
	print(':(')
else:
	print(s2)


t = input().strip()
length = len(t)
s = []
s_dot = []
last_a = 0
for i in range(length - 1, -1, -1):
	if t[i] == 'a':
		last_a = i
		break
last_a += 1
for i in range(last_a):
	if t[i] != 'a':
		s.append(t[i])
if len(s) > length - last_a:
	print(':(')
elif len(s) == length - last_a:
	if len(s) != 0:
		for i in range(last_a, length):
			s_dot.append(t[i])
		equal = True
		for i in range(len(s)):
			if s[i] != s_dot[i]:
				equal = False
		if equal:
			ans = []
			ctr = 0
			for i in range(length):
				if ctr >= len(s) and i >= last_a:
					break
				ans.append(t[i])
				if t[i] != 'a':
					ctr += 1
			print(''.join(ans))
		else:
			print(':(')
	else:
		print(t)
else:
	s_dot_len = length - last_a
	s_dot_index = 0
	s_len = len(s)
	for i in range(last_a, length):
		if s_dot_len <= s_len:
			s_dot_index = i
			break
		s.append(t[i])
		s_len += 1
		s_dot_len -= 1
	if s_len != s_dot_len:
		print(':(')
	else:
		equal = True
		s_dot = []
		for i in range(s_dot_index, length):
			s_dot.append(t[i])
		for i in range(s_len):
			if s[i] != s_dot[i]:
				equal = False
				break
		if equal:
			ans = []
			ctr = 0
			for i in range(length):
				if ctr >= s_len and i >= last_a:
					break
				ans.append(t[i])
				if t[i] != 'a':
					ctr += 1
			print(''.join(ans))
		else:
			print(':(')


s = input()
wyn = 0
for i in s:
	if i == 'a':
		wyn += 1
l = len(s)
import sys
if (l - wyn) % 2 != 0:
	print(':(')
	sys.exit(0)
dl = (l - wyn) // 2
pocz = s[:l - dl]
kon = s[l - dl:]
b = []
c = []
for i in pocz:
	if i != 'a':
		b.append(i)
for i in kon:
	c.append(i)
if b == c:
	print(pocz)
else:
	print(':(')


st = input()
cou = st.count('a')
if cou == len(st):
	print(st)
else:
	re = ''
	for i in range(len(st)):
		if st[i] != 'a':
			re += st[i]
	if len(re) % 2 != 0:
		print(':(')
	else:
		res = len(re) // 2
		us_st = st
		end_st = ''
		for i in range(len(us_st) - 1, -1, -1):
			if us_st[i] == 'a':
				break
			else:
				end_st += us_st[i]
		end_st = end_st[::-1]
		fin_end = end_st[-res:]
		sta_st = ''
		for i in range(res):
			sta_st += re[i]
		if fin_end == sta_st:
			print(us_st[:-res])
		else:
			print(':(')


t = input()
s_ = [i for i in t if i != 'a']
s_ = ''.join(s_[:len(s_) // 2])
s = t[:len(t) - len(s_)]
print(s if s + ''.join([i for i in s if i != 'a']) == t else ':(')


t = str(input())
cop = t
c = t
cop = cop.replace('a', '')
cou = t.count('a')
c = c.replace(t[0:len(cop) // 2 + cou], '')
if len(cop) == 0:
	print(t)
elif cop[0:len(cop) // 2] == cop[len(cop) // 2:len(cop)] and 'a' not in c:
	print(t[0:len(cop) // 2 + cou])
else:
	print(':(')


from sys import stdin
import math
from copy import deepcopy
from collections import defaultdict

def get_no_a(string):
	no_a = []
	for i in string:
		if i != 'a':
			no_a.append(i)
	return ''.join(no_a)
string = list(stdin.readline().strip())
no_a = get_no_a(string)
arr = [0] * len(string)
for i in range(len(string) - 2, -1, -1):
	if string[i + 1] == 'a':
		arr[i] = 1 + arr[i + 1]
	else:
		arr[i] = arr[i + 1]
if no_a == '' or no_a[:len(no_a) // 2] == no_a[len(no_a) // 2:]:
	compare = list(no_a[:len(no_a) // 2])
	index = 0
	i = 0
	ans = []
	while i < len(string):
		if index >= len(compare):
			break
		if string[i] == compare[index]:
			ans.append(string[i])
			i += 1
			index += 1
		else:
			ans.append(string[i])
			i += 1
	while i < len(string):
		if arr[i] > 0 or string[i] == 'a':
			ans.append(string[i])
		else:
			break
		i += 1
	if get_no_a(ans) == ''.join(compare):
		print(''.join(ans))
	else:
		print(':(')
else:
	print(':(')


s = input()
n = len(s)
x = s.count('a')
t = n - x
if t & 1:
	print(':(')
else:
	t //= 2
	y = ''
	for i in range(n - 1, n - t - 1, -1):
		y += s[i]
	y = y[::-1]
	count = j = flag = i = 0
	while i < n - t and j < t:
		if s[i] == 'a':
			i += 1
		elif s[i] == y[j]:
			count += 1
			i += 1
			j += 1
		else:
			flag = 1
			break
	if count == t:
		print(s[:x + t])
	else:
		print(':(')


s = input()
st = s.replace('a', '')
l = len(st) // 2
if st[:l] == st[l:] and s[s.rfind(st[l:]):] == st[l:]:
	print(s[:s.rfind(st[l:])])
else:
	print(':(')


from collections import Counter

def func(s):
	res = []
	for c in s:
		if c != 'a':
			res.append(c)
	return ''.join(res)
s = input()
n = len(s)
c = Counter(list(s))
m = n - c['a']
if m % 2 != 0:
	print(':(')
else:
	t = s[:m // 2 + c['a']]
	if func(t) == s[m // 2 + c['a']:]:
		print(t)
	else:
		print(':(')


t = input()
s = ''
for i in t:
	if i != 'a':
		s += i
if len(s) % 2 != 0:
	print(':(')
	exit(0)
if int(len(s) / 2) == 0:
	print(t)
elif s[:int(len(s) / 2)] == s[int(len(s) / 2):] and t[:-int(len(s) / 2)] + s[:int(len(s) / 2)] == t:
	print(t[:-int(len(s) / 2)])
else:
	print(':(')


st = input()
if len(set(st)) == 1 and 'a' in set(st):
	print(st)
	exit()
new = ''
for i in st:
	if i != 'a':
		new += i
if len(new) % 2 == 1:
	print(':(')
	exit()
if new[:len(new) // 2] != new[len(new) // 2:]:
	print(':(')
	exit()
if st[-(len(new) // 2):] != new[len(new) // 2:]:
	print(':(')
	exit()
print(st[:len(st) - len(new) // 2])


s = input()
s2 = ''
for i in range(len(s)):
	if s[i] != 'a':
		s2 += s[i]
if len(s2) % 2:
	print(':(')
else:
	l = len(s2) // 2
	c = s.count('a')
	if s2[0:l] != s[l + c:]:
		print(':(')
	else:
		print(s[:c + l])


t = input()
lng = len(t)
li1 = []
li2 = []
for i in range(lng):
	if t[i] != 'a':
		li1.append(t[i])
	elif t[i] == 'a':
		li2.append(i)
aa = ''.join(li1)
if len(aa) == 0:
	print(t)
	exit(0)
if len(aa) % 2 == 1:
	print(':(')
	exit(0)
if len(aa) % 2 == 0:
	l = int(len(aa) / 2)
	lp = l
	ll = aa[l:]
	lll = aa[0:l]
	if ll != lll:
		print(':(')
		exit(0)
	if ll not in t:
		print(':(')
		exit(0)
	tp = t[::-1]
	tc = ll[::-1]
	if tp.find(tc) != 0:
		print(':(')
		exit(0)
	if tp.find(tc) == 0:
		ul = len(tc)
		lu = tp[ul:][::-1]
		print(lu)
		exit(0)


def check(arr, s):
	if len(arr) != len(s):
		return False
	n = len(arr)
	for i in range(n):
		if arr[i] != s[i]:
			return False
	return True
s = input()
n = len(s)
cta = s.count('a')
ans = ':('
new = 0
if cta == n:
	ans = s
elif cta == 0:
	if n % 2 == 0 and s[:n // 2] == s[n // 2:]:
		ans = s[:n // 2]
else:
	ind = 0
	rem = []
	for i in range(n):
		if s[i] == 'a':
			ind = i
	for i in range(ind):
		if s[i] != 'a':
			rem.append(s[i])
			new += 1
	for i in range(ind + 1, n):
		rem_len = n - i
		if rem_len == new:
			if check(rem, s[i:]):
				ans = s[:i]
			break
		else:
			rem.append(s[i])
			new += 1
print(ans)


s = input()
p = (len(s) + s.count('a')) // 2
print([':(', s[:p]][s[p:] * 2 == s.replace('a', '')])


t = input()
half = (len(t) - 1) // 2
s = t[:half]
sna = s.replace('a', '')
for i in range(half, len(t)):
	c = t[i]
	s += c
	if c != 'a':
		sna += c
	if s + sna == t:
		print(s)
		break
else:
	print(':(')


s = input().strip()
su = 0
for k in range(len(s)):
	if s[k] == 'a':
		su += 1
mm = (len(s) - su) // 2 + su
ss = s[:mm]
s1 = ''
for k in range(mm):
	if s[k] != 'a':
		s1 = s1 + s[k]
sf = ss + s1
if len(s) != len(sf):
	print(':(')
else:
	for k in range(len(s)):
		if s[k] != sf[k]:
			print(':(')
			break
	else:
		print(ss)


import sys
s = input()
t1 = ''
for (i, c) in enumerate(s):
	if c != 'a':
		t1 += c
	if s[i + 1:] == t1:
		print(s[:i + 1])
		sys.exit(0)
print(':(')


s = input()
s1 = ''
s2 = ''
s3 = ''
for i in range(0, len(s)):
	if s[i] != 'a':
		s1 += s[i]
for i in range(0, len(s1)):
	if i < len(s1) / 2:
		s2 += s1[i]
	else:
		s3 += s1[i]
s1 = ''
for i in range(0, len(s) - len(s3)):
	s1 += s[i]
if s1 + s3 == s and s2 == s3:
	print(s1)
else:
	print(':(')


s = input()
res = ''
cnt = 0
for i in s:
	if i != 'a':
		res += i
	else:
		cnt += 1
if len(res) % 2:
	print(':(')
else:
	s1 = res[:len(res) // 2]
	s2 = res[len(res) // 2:]
	if s1 == s2:
		ans = s[:len(res) // 2 + cnt]
		res = ''
		for i in ans:
			if i != 'a':
				res += i
		if s == ans + res:
			print(ans)
		else:
			print(':(')
	else:
		print(':(')


s = input()
m = (len(s) - s.count('a')) // 2
t = s[len(s) - m:]
if s[:len(s) - m].replace('a', '') == t:
	print(s[:len(s) - m])
else:
	print(':(')


s = input()
ans = ':('
if 'a' not in s:
	jk = len(s) // 2
	you = s[0:jk]
	tou = s[jk:]
	if you == tou:
		ans = you
else:
	string = ''
	count = 0
	for i in range(0, len(s)):
		if s[i] == 'a':
			indic = i
			count = count + 1
	x = len(s) - indic - 1 - indic - 1 + count
	x = x // 2
	if x < 0:
		x = 0
	a1 = s[0:indic + 1 + x]
	a2 = s[indic + 1 + x:]
	for i in a1:
		if i != 'a':
			string = string + i
	if string != a2:
		ans = ':('
	else:
		ans = a1
print(ans)


s = input()
dp = [0] * len(s)
dp[0] = int(s[0] != 'a')
i = 0
while i != len(s) - 1:
	i += 1
	dp[i] = dp[i - 1] + int(s[i] != 'a')
for i in range(len(s)):
	if i + 1 + dp[i] == len(s):
		q = [r for r in s[:i + 1] if r != 'a']
		if s[:i + 1] + ''.join(q) == s:
			print(s[:i + 1])
			exit()
print(':(')


t = input()
s = t.replace('a', '')
if len(s) % 2 == 0:
	if s[0:len(s) // 2] == t[len(t) - len(s) // 2:len(t)]:
		print(t[0:len(t) - len(s) // 2])
	else:
		print(':(')
else:
	print(':(')


s = input()
l = len(s)
a = s.count('a')
if (l + a) % 2 == 1:
	print(':(')
else:
	og = s[:(l + a) // 2]
	newg = ''
	for char in og:
		if char != 'a':
			newg += char
	if newg == s[(l + a) // 2:]:
		print(og)
	else:
		print(':(')


t = list(input())
pal = []
for i in t:
	if i != 'a':
		pal.append(i)
if pal == []:
	print(''.join(t))
elif len(pal) % 2 == 1 or t[len(t) - 1] == 'a':
	print(':(')
else:
	flag = True
	o = len(pal) // 2
	l = pal[:o]
	r = pal[o:]
	for i in range(len(l)):
		if l[i] != r[i]:
			flag = False
			break
	if flag:
		for i in range(len(r)):
			u = len(t) - 1
			if t[u] == 'a':
				flag = False
				break
			del t[u]
		if flag:
			print(''.join(t))
		else:
			print(':(')
	else:
		print(':(')


T = input()
S = ''
for i in range(len(T)):
	if T[i] != 'a':
		S = S + T[i]
num = len(S) // 2
betw1 = S[0:num]
betw2 = S[num:]
S_star = T[0:len(T) - num]
if T == S_star + betw1 and T == S_star + betw2:
	print(S_star)
else:
	print(':(')


word = input()
alpha = word.replace('a', '')
if len(alpha) % 2 == 1:
	print(':(')
elif len(alpha) == 0:
	print(word)
else:
	a1 = word[-(len(alpha) // 2):]
	if word[:-(len(alpha) // 2)].replace('a', '') == a1:
		print(word[:-(len(alpha) // 2)])
	else:
		print(':(')


t = input()
tca = t.count('a')
lt = len(t)
s1 = list(t[:(lt - tca) // 2 + tca])
s2 = list(t[(lt - tca) // 2 + tca:])
s1da = [c for c in s1 if c != 'a']
if s1da == s2:
	print(*s1, sep='')
else:
	print(':(')


text = input()
if text.count('a') == len(text):
	print(text)
	exit()
for i in range(len(text)):
	if text[i] != 'a':
		x = text.replace('a', '')
		half = int(len(x) / 2)
		if x[:half] == x[half:] and 'a' not in text[len(text) - half:]:
			print(text[:len(text) - half])
			exit()
		else:
			print(':(')
			exit()


def f(t):
	ss = ''
	for x in t:
		if x != 'a':
			ss += x
	n = len(ss)
	if n == 0:
		return t
	if ss[:n // 2] == ss[n // 2:]:
		if t[-n // 2:] == ss[:n // 2]:
			return t[:-n // 2]
	return ':('
t = input()
print(f(t))


s1 = str(input())
s = ''
index = -1
for i in range(len(s1)):
	if s1[i] != 'a':
		s += s1[i]
	else:
		index = i
if len(s) == 0:
	print(s1)
elif index == -1:
	if len(s) % 2 != 0:
		print(':(')
	else:
		k = len(s) // 2
		if s[:k] != s[k:]:
			print(':(')
		else:
			print(s1[:len(s1) - k])
else:
	size = len(s1) - (index + 1)
	if len(s) > size * 2 or len(s) % 2 != 0:
		print(':(')
	else:
		k = len(s) // 2
		if s[:k] != s[k:]:
			print(':(')
		else:
			print(s1[:len(s1) - k])


s = input()
l = len(s) + s.count('a') >> 1
t = s
s = s.replace('a', '')
if len(s) & 1:
	print(':(')
elif s[:len(s) >> 1] == t[l:]:
	print(t[:l])
else:
	print(':(')


input_string = input()
map = {}
map['a'] = []
for i in range(0, len(input_string)):
	if input_string[i] == 'a':
		map['a'].append(i)
if len(map['a']) > 0:
	index = map['a'][-1]
	equal = False
	while index < len(input_string):
		first_string = input_string[:index + 1]
		second_string = input_string[index + 1:]
		temp = first_string.replace('a', '')
		if temp == second_string:
			equal = True
			break
		else:
			index += 1
		if len(temp) >= len(second_string):
			break
	if equal == True:
		first_string = input_string[:index + 1]
		print(first_string)
	else:
		print(':(')
else:
	first_string = input_string[:int(len(input_string) / 2)]
	second_string = input_string[int(len(input_string) / 2):]
	if first_string == second_string:
		print(first_string)
	else:
		print(':(')


string = input()
string = list(string)
copy_string = []
counter = 0
counter_a = 0
inc = 0
true_counter = 0
final_string = []
length = len(string)
for i in range(length):
	if string[i] != 'a':
		copy_string.append(string[i])
	else:
		counter_a += 1
copy_length = len(copy_string)
if copy_length == 0:
	print(''.join(string))
elif copy_length % 2 != 0:
	print(':(')
else:
	s = counter_a + copy_length // 2
	for j in range(s, length):
		if copy_string[inc] == string[j]:
			true_counter = true_counter + 1
		inc = inc + 1
	if true_counter == copy_length // 2:
		for x in range(s):
			final_string.append(string[x])
		print(''.join(final_string))
	else:
		print(':(')


s = input()
if 'a' in s:
	n = s[::-1].index('a')
	n = len(s) - (n + 1)
	if len(set(s)) == 1 and s[0] == 'a':
		print(s)
		exit()
	if s[n + 1:] == '':
		print(':(')
	else:
		x = s[:n + 1]
		d = ''
		for val in x:
			if val != 'a':
				d += val
		for i in range(n + 1, len(s)):
			if d + s[n + 1:i] == s[i:]:
				print(x + s[n + 1:i])
				exit()
		print(':(')
elif len(s) % 2 == 1:
	print(':(')
elif s[:len(s) // 2] != s[len(s) // 2:]:
	print(':(')
else:
	print(s[:len(s) // 2])


t = input()
extras = 0
for letter in t:
	if letter != 'a':
		extras += 1
if extras % 2 == 0:
	cut = extras / 2
else:
	print(':(')
	exit(0)
if cut == 0:
	print(t)
	exit(0)
s = t[:int(-cut)]
ss = t[int(len(t) - cut):]
if ss == s.replace('a', ''):
	print(s)
else:
	print(':(')


t = input()
start_s_prime = None
count_not_as = 0
possible = True
for i in range(len(t)):
	if start_s_prime is None:
		if count_not_as == len(t) - i:
			start_s_prime = i
		elif t[i] != 'a':
			count_not_as += 1
	elif t[i] == 'a':
		possible = False
		break
if not possible:
	print(':(')
elif start_s_prime is not None:
	s = t[:start_s_prime]
	s_prime = s.replace('a', '')
	if t == s + s_prime:
		print(s)
	else:
		print(':(')
else:
	s = t[:]
	s_prime = s.replace('a', '')
	if t == s + s_prime:
		print(s)
	else:
		print(':(')


s = input()
if len(set(s)) == 1 and s[0] == 'a':
	print(s)
else:
	s1 = ''
	for i in range(len(s)):
		if s[i] != 'a':
			s1 += s[i]
	h = len(s1) // 2
	if len(s1) % 2 == 0:
		if s[len(s) - h:] == s1[:h]:
			print(s[:len(s) - h])
		else:
			print(':(')
	else:
		print(':(')


string = input()
newString = str()
for x in string:
	if x != 'a':
		newString += x
if not len(newString):
	print(string)
elif len(newString) % 2:
	print(':(')
elif newString[:int(len(newString) / 2)] != newString[int(len(newString) / 2):]:
	print(':(')
elif newString[:int(len(newString) / 2)] != string[-int(len(newString) / 2):]:
	print(':(')
else:
	print(string[:len(string) - int(len(newString) / 2)])


t = input()
n = len(t)
pref = [0] * n
pred = 0
for i in range(n):
	if t[i] == 'a':
		pref[i] += 1
	pref[i] += pred
	pred = pref[i]
for i in range(n):
	if pref[n - 1] - pref[i] == 0:
		if i - pref[i] + 1 == n - i - 1:
			f = True
			uk1 = 0
			uk2 = i + 1
			while uk2 < n:
				while t[uk1] == 'a':
					uk1 += 1
				if t[uk1] != t[uk2]:
					f = False
					break
				uk1 += 1
				uk2 += 1
			if f:
				for j in range(i + 1):
					print(t[j], end='')
				exit(0)
print(':(')


str = input()
counter = str.count('a')
cc = counter
l = len(str)
t = ''
s = ''
s1 = ''
i = 0
while counter > 0 and i < l:
	c = str[i]
	if c == 'a':
		counter -= 1
	else:
		s += c
	t += c
	i += 1
if s == s1 and l == cc:
	print(t)
else:
	nstr = s + str[i:]
	nlen = len(nstr) // 2
	acounter = str[-nlen:].count('a')
	if nstr[:nlen] == nstr[nlen:] and acounter == 0:
		print(str[:-nlen])
	else:
		print(':(')


import sys

def end():
	print(':(')
	sys.exit(0)
s = input()
n_a = 0
for c in s:
	if c == 'a':
		n_a += 1
if (len(s) - n_a) % 2 == 1:
	end()
l = (len(s) - n_a) // 2
s_1 = []
for i in range(l + n_a):
	if s[i] != 'a':
		s_1.append(s[i])
if len(s_1) != l:
	end()
s_1 = ''.join(s_1)
s_2 = s[l + n_a:]
if s_1 != s_2:
	end()
print(s[:l + n_a])


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
t = stringIn()
s = ''
flag = True
cnta = 0
l = len(t)
cnta = t.count('a')
if cnta == l:
	print(t)
	exit(0)
ls = l - cnta
if ls % 2 == 0:
	c = (l + cnta) // 2
	s = t[:c]
	ss = ''
	for i in range(c):
		if s[i] != 'a':
			ss += s[i]
	if ss == t[c:]:
		ans = s
	else:
		flag = False
else:
	flag = False
if flag:
	print(ans)
else:
	print(':(')


s = input()
s_dash = 0
ss = ''
lenn = len(s)
for i in range(lenn):
	if s[i] != 'a':
		s_dash += 1
		ss += s[i]
if s_dash % 2 != 0:
	print(':(')
else:
	ss = ss[:s_dash // 2]
	if 'a' not in s[lenn - s_dash // 2:] and ss == s[lenn - s_dash // 2:]:
		print(s[:lenn - s_dash // 2])
	else:
		print(':(')


t = list(input())
n = len(t)
if t.count('a') == 0 and t[0:int(n / 2):1] == t[int(n / 2):n:1]:
	print(''.join(list(t[0:int(n / 2):1])))
else:
	ia = n - 1
	while ia >= 0 and t[ia] != 'a':
		ia -= 1
	idx = ia + 1
	s1 = []
	s2 = []
	for aa in range(0, idx):
		if t[aa] != 'a':
			s1.append(t[aa])
	if (len(s1) + (n - idx)) % 2 != 0 or len(s1) > n - idx:
		print(':(')
	else:
		m = int((len(s1) + (n - idx)) / 2)
		chk = len(s1)
		for i in range(idx, idx + m - len(s1)):
			s1.append(t[i])
		s2 = t[idx + m - chk:n]
		if s1[:] == s2[:]:
			print(''.join(t[:idx + m - chk]))
		else:
			print(':(')


n = str(input())
rem = n.replace('a', '')
size = int(len(rem) / 2)
if rem[:size] == rem[size:] and n[-size:].count('a') == 0 and (len(rem) != 0):
	print(n[:-size])
elif len(rem) == 0:
	print(n)
else:
	print(':(')


original = input()
replaced = original.replace('a', '')
n = len(replaced)
if not n:
	print(original)
elif replaced[:n // 2] == original[-n // 2:]:
	print(original[:-n // 2])
else:
	print(':(')


string = input()
end = ''
bo = False
for x in range(len(string)):
	if string[x] != 'a':
		end += string[x]
	if end == string[x + 1:]:
		bo = True
		break
if bo:
	print(string[:x + 1])
else:
	print(':(')


s = input()
t = ''
for i in s:
	if i != 'a':
		t += i
if len(t) % 2:
	print(':(')
	return
q = t[:len(t) // 2]
w = t[len(t) // 2:]
if q != w:
	print(':(')
	return
cnt = 0
if len(q) != 0 and s[-len(q):] == q:
	print(s[:-len(q)])
elif len(q) == 0:
	print(s)
else:
	print(':(')


s = input()
nota = len(s) - s.count('a')
if nota % 2 != 0:
	print(':(')
elif nota == 0:
	print(s)
elif s[-nota // 2:].count('a') > 0:
	print(':(')
else:
	s1 = s.replace('a', '')
	if s1[:nota // 2] != s1[nota // 2:]:
		print(':(')
	else:
		print(s[:-nota // 2])


t = input()
s = t.replace('a', '')
n = len(s)
if not n:
	print(t)
elif s[:n // 2] == t[-n // 2:]:
	print(t[:-n // 2])
else:
	print(':(')


t = input()
r = ''
for i in t:
	r += i if i != 'a' else ''
l = len(r) // 2
s_ = r[:l]
idx = t.rfind(s_)
s = t[:idx]
if idx != -1 and s_ == r[l:] and (s + s_ == t):
	print(s)
else:
	print(':(')


import sys, re
arr = list(sys.stdin.readline().rstrip())
back = len(arr)
for i in range(len(arr) - 1, -1, -1):
	if arr[i] == 'a':
		break
	back = i
temp = arr[:back]
res = []
for i in temp:
	if i != 'a':
		res.append(i)
if len(res) > len(arr) - back:
	print(':(')
else:
	res = res + arr[back:]
	left = []
	right = []
	n = len(res)
	for i in range(n // 2):
		left.append(res[i])
	for i in range(n // 2, n):
		right.append(res[i])
	if left != right:
		print(':(')
	else:
		for i in range(len(right)):
			arr.pop()
		print(''.join(arr))


s = input()
l = []
for i in s:
	if i != 'a':
		l.append(i)
a = len(l)
f = 0
for k in s[len(s) - a // 2:]:
	if k == 'a':
		print(':(')
		exit()
if a % 2 == 0:
	for j in range(a // 2):
		if l[j] != l[a // 2 + j]:
			f = 1
	if f == 1:
		print(':(')
	else:
		print(s[:len(s) - a // 2])
else:
	print(':(')


t = input()
t1 = ''
for i in t:
	if i != 'a':
		t1 += i
if t1[:len(t1) // 2] == t1[len(t1) // 2:]:
	if not 'a' in t:
		print(t[:len(t) - len(t1) // 2])
	elif t.rfind('a') < len(t) - len(t1) // 2:
		print(t[:len(t) - len(t1) // 2])
	else:
		print(':(')
else:
	print(':(')


t = input()
s = ''
ka = t.count('a')
for i in range((len(t) + ka) // 2):
	if t[i] != 'a':
		s += t[i]
if t[(len(t) + ka) // 2:] == s:
	print(t[:(len(t) + ka) // 2])
else:
	print(':(')


s1 = input()
s = []
c = 0
f1 = 0
for i in s1:
	if i != 'a':
		s.append(i)
	else:
		c = c + 1
n1 = len(s1) - 1
for i in range(0, len(s) // 2):
	if s1[n1 - i] == 'a':
		f1 = 1
if len(s) == 0:
	print(s1)
	exit(0)
elif len(s) % 2 == 1:
	print(':(')
	exit(0)
elif f1 == 1:
	print(':(')
	exit(0)
else:
	n = len(s)
	f = 0
	for i in range(n // 2):
		y = n // 2
		y = y + i
		if s[i] != s[y]:
			f = 1
			break
	if f == 0:
		x = n // 2 + c
		print(s1[0:x])
	else:
		print(':(')


s = input()
c = s.count('a')
n_s = s.replace('a', '')
idx = len(n_s) // 2
if len(n_s) % 2 != 0:
	print(':(')
elif n_s[:idx] == n_s[idx:] and n_s[idx:] == s[idx + c:]:
	print(s[:idx + c])
else:
	print(':(')


import math
t = input()
rt = t.replace('a', '')
length = len(rt) // 2
if len(rt) % 2 != 0:
	print(':(')
else:
	res = t[0:len(t) - length]
	var = t[len(t) - length:len(t)]
	sea = res.replace('a', '')
	if sea == var:
		print(res)
	else:
		print(':(')


import sys
s = sys.stdin.readline().strip()
s1 = s.split('a')
s2 = ''.join(s1)
if s2 == '':
	print(s)
else:
	print(s[:len(s) - len(s2) // 2] if len(s2) % 2 == 0 and s2[:len(s2) // 2] == s1[-1][len(s1[-1]) - len(s2) // 2:] else ':(')


t = input()
c0 = 0
c1 = 0
for each in t:
	if each == 'a':
		c0 += 1
	else:
		c1 += 1
res = ''
if c1 % 2 != 0:
	print(':(')
elif c1 == 0:
	print(t)
else:
	s0 = ''
	s1 = ''
	counter = 0
	for each in t:
		if each != 'a':
			if counter >= c1 // 2:
				s1 += each
			else:
				s0 += each
				counter += 1
	if s0 == s1:
		counter = 0
		ca = 0
		cb = 0
		for each in t:
			if counter == c0 + c1 // 2:
				break
			else:
				if each == 'a':
					ca += 1
				else:
					cb += 1
				res += each
				counter += 1
		if ca == c0:
			print(res)
		else:
			print(':(')
	else:
		print(':(')


s = input()
c = 0
for i in s:
	if i == 'a':
		c = c + 1
nb = len(s) - c
if nb % 2 == 0:
	nb = nb // 2
	a = s[:nb + c]
	b = s[nb + c:]
	z = ''
	for i in a:
		if i != 'a':
			z = z + i
	if z == b:
		print(a)
	else:
		print(':(')
else:
	print(':(')


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import *
from itertools import *
import functools
import sys
import math
import random
import re
MAX = sys.maxsize
MAXN = 10 ** 5 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b, x, y):
	return abs(a - x) + abs(b - y)

def numIN(x=' '):
	return map(int, sys.stdin.readline().strip().split(x))

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN():
	return list(numIN())

def dis(x, y):
	a = y[0] - x[0]
	b = x[1] - y[1]
	return (a * a + b * b) ** 0.5

def lgcd(a):
	g = a[0]
	for i in range(1, len(a)):
		g = math.gcd(g, a[i])
	return g

def ms(a):
	msf = -MAX
	meh = 0
	for i in range(len(a)):
		meh += a[i]
		if msf < meh:
			msf = meh
		if meh < 0:
			meh = 0
	return msf

def res(ans, t):
	print('Case #{}: {}'.format(t, ans))
s = input()
n = len(s)
c = s.count('a')
if c == n:
	print(s)
elif c == 0:
	if n % 2:
		print(':(')
	elif s[:n // 2] == s[n // 2:]:
		print(s[:n // 2])
	else:
		print(':(')
else:
	for i in range(n):
		if s[i] == 'a':
			ind = i
	rem = n - 1 - ind
	z = rem + ind + 1 - c
	if z % 2:
		print(':(')
		exit(0)
	if rem == ind + 1 - c:
		x = ''.join([i for i in s[:ind + 1] if i != 'a'])
		if x == s[ind + 1:]:
			print(s[:ind + 1])
		else:
			print(':(')
	elif rem < ind + 1 - c:
		print(':(')
	else:
		while rem > ind + 1 - c:
			ind += 1
			rem -= 1
		x = ''.join([i for i in s[:ind + 1] if i != 'a'])
		if x == s[ind + 1:]:
			print(s[:ind + 1])
		else:
			print(':(')


def main():
	t = input()
	s1 = ''
	s = ''
	index = -1
	for i in range(len(t) - 1, -1, -1):
		if t[i] != 'a':
			s1 += t[i]
		else:
			index = i
			break
	s1list = list(s1)
	s1 = ''
	s1list.reverse()
	for i in s1list:
		s1 += i
	for i in range(index + 1):
		s += t[i]
	snew = ''
	for i in s:
		if i != 'a':
			snew += i
	while True:
		if len(snew) > len(s1):
			break
		if snew == s1:
			break
		snew += s1[0]
		s += s1[0]
		s1 = s1[1:]
	if snew != s1:
		print(':(')
		return
	if t != s + s1:
		print(':(')
		return
	print(s)
main()


s = list(input())
e = len(s) - s.count('a')
if e == 0:
	print(''.join(s))
elif s[-1] == 'a':
	print(':(')
elif e % 2 != 0:
	print(':(')
else:
	t = len(s) - e // 2
	i = 0
	j = t
	flag = 0
	while i <= t - 1 and j <= len(s) - 1:
		if s[i] == s[j] or s[j] == '':
			i += 1
			j += 1
			flag = 1
		elif s[i] == 'a':
			i += 1
		else:
			flag = 0
			break
	if flag == 0:
		print(':(')
	else:
		print(''.join(s[:t]))


s = input()
n = len(s) - s.count('a')
if n % 2:
	print(':(')
elif s[len(s) - n // 2:] != s[0:len(s) - n // 2].replace('a', ''):
	print(':(')
else:
	print(s[0:len(s) - n // 2])


def main():
	s = input()
	a = ''
	for i in s:
		if i != 'a':
			a += i
	if len(a) & 1:
		print(':(')
		return 0
	n = len(a) >> 1
	A = a[:n]
	B = a[n:]
	if A != B:
		print(':(')
		return 0
	N = len(s)
	if s[N - n:] == A:
		print(s[:N - n])
		return 0
	else:
		print(':(')
		return 0
main()


def solve(s):
	n = len(s)
	a = s.count('a')
	if (n - a) % 2:
		return ':('
	else:
		ind = a + (n - a) // 2
		stack = ''
		for i in range(ind):
			if s[i] != 'a':
				stack += s[i]
		for j in range(ind, n):
			if stack[j - ind] != s[j]:
				return ':('
		return s[:ind]
s = input()
print(solve(s))


s = input()
a = ''
(ind, last) = (0, -1)
for i in s:
	if i != 'a':
		a = a + i
	else:
		last = ind
	ind += 1
if len(a) % 2 == 0 and a[:len(a) // 2] == a[len(a) // 2:] and (last < len(s) - len(a) // 2):
	print(s[:len(s) - len(a) // 2])
else:
	print(':(')


t = input()
last_a = -1
s1 = ''
for i in range(len(t)):
	if t[i] == 'a':
		last_a = i
fim = False
if last_a == -1 and len(t) % 2 == 0 and (t[:len(t) // 2 + 1] == t[len(t) // 2 + 1:]):
	print(':(')
	fim = True
else:
	for i in range(last_a):
		if t[i] != 'a':
			s1 += t[i]
	if len(s1) == len(t) - last_a - 1:
		if s1 == t[last_a + 1:]:
			print(t[:last_a + 1])
			fim = True
	elif len(s1) > len(t) - last_a - 1:
		print(':(')
		fim = True
	else:
		last_a += 1
		while True:
			if last_a >= len(t):
				break
			s1 += t[last_a]
			if len(s1) == len(t) - last_a - 1:
				break
			last_a += 1
		if s1 == t[last_a + 1:]:
			print(t[:last_a + 1])
			fim = True
		else:
			print(':(')
			fim = True
if not fim:
	print(':(')


s = input()
if set(s) == {'a'}:
	print(s)
else:
	sno = s.replace('a', '')
	l = len(sno)
	if l % 2 == 0 and sno[:l // 2] == sno[l // 2:] == s[-l // 2:]:
		print(s[:-l // 2])
	else:
		print(':(')


val = input()
newVal = val.replace('a', '')
if len(newVal) == 0:
	print(val)
elif len(newVal) % 2 == 1:
	print(':(')
elif val[0:len(val) - len(newVal) // 2] + newVal[0:len(newVal) // 2] == val:
	print(val[0:len(val) - len(newVal) // 2])
else:
	print(':(')


def check(t, n):
	flag = True
	if n % 2 != 0:
		return False
	mid = n // 2
	i = 0
	while i < n // 2:
		if t[i] != t[mid]:
			flag = False
			break
		i += 1
		mid += 1
	return flag
t = input()
n = len(t)
S = set(t)
if len(S) == 1 and 'a' in S:
	print(t)
elif t.count('a') == 0:
	if n % 2 == 1:
		print(':(')
	elif not check(t, n):
		print(':(')
	else:
		print(t[:n // 2])
else:
	s = ''
	for i in range(n):
		if t[i] != 'a':
			s += t[i]
	if check(s, len(s)):
		s = s[len(s) // 2:]
		if t[n - len(s):] == s:
			print(t[:n - len(s)])
		else:
			print(':(')
	else:
		print(':(')


t = input()
x = ''
p = ''
for i in range(len(t)):
	x = x + t[i]
	if t[i] != 'a':
		p = p + t[i]
	if t == x + p:
		print(x)
		exit(0)
print(':(')


st = input()
st2 = st
numA = st.count('a')
if len(st) == numA:
	print(st)
	exit()
s = ''
s = st2[:int((len(st) - numA) / 2) + numA]
s2 = s
s_ = st2[int((len(st) - numA) / 2) + numA:]
for char in s:
	if char == 'a':
		s = s.replace(char, '')
if s == s_:
	print(s2)
else:
	print(':(')


a = input()
s = ''
for t in a:
	if t != 'a':
		s += t
k = int(len(s) / 2)
if s == '':
	print(a)
elif s[:k] == s[k:]:
	if a[-k:].count('a') == 0:
		print(a[:-k])
	else:
		print(':(')
else:
	print(':(')


t = input()
if 'a' in t:
	r = t[::-1].index('a')
	r = len(t) - r - 1
	k = t[:r + 1]
	st = ''
	for i in k:
		if i != 'a':
			st = st + i
	t2 = t[r + 1:]
	ex = (len(t2) - len(st)) // 2
	f1 = t2[:ex]
	f2 = t2[ex:ex + len(st)]
	f3 = t2[ex + len(st):]
	if f1 == f3 and f2 == st:
		print(k + f1)
	else:
		print(':(')
elif t[:len(t) // 2] == t[len(t) // 2:]:
	print(t[:len(t) // 2])
else:
	print(':(')


import sys
S = input()
L = len(S)
S2 = ''
for s in S:
	if s != 'a':
		S2 += s
if len(S2) % 2 != 0:
	print(':(')
	return
L2 = len(S2) // 2
if L2 == 0:
	print(S)
	return
S3 = S2[:L2]
if S[-L2:] == S3:
	print(S[:-L2])
else:
	print(':(')
	return


t = input()
ss = t.replace('a', '')
if len(ss) == 0:
	print(t)
	exit()
if len(ss) % 2 == 0 and ss[:len(ss) // 2] == t[-len(ss) // 2:]:
	print(t[:-len(ss) // 2])
	exit()
print(':(')


s = input()
s2 = s.replace('a', '')
if len(s2) % 2 == 1 or (s[-1] == 'a' and len(s2) != 0):
	print(':(')
else:
	half = len(s2) // 2
	if s2[:half] == s2[half:] and 'a' not in s[len(s) - half:]:
		print(s[:len(s) - half])
	else:
		print(':(')


str = input()
l = len(str)
str1 = list(str)
st = ''
for i in range(len(str)):
	if str[i] != 'a':
		st = st + str[i]
if len(st) % 2 == 0:
	er = len(st) // 2
	if st[0:er] == st[er:len(st)] and str[l - er:].__contains__(st[er:len(st)]):
		print(str[0:l - er])
	else:
		print(':(')
else:
	print(':(')


a = input()
c = a.count('a')
new = a.replace('a', '')
k = len(new)
if k % 2 == 0 and new[:k // 2] == new[k // 2:] and (a[:k // 2 + c].count('a') == c):
	print(a[:k // 2 + c])
else:
	print(':(')


t = input()
temp = len(t.replace('a', '')) // 2
if len(t.replace('a', '')) == 0:
	print(t)
elif len(t.replace('a', '')) % 2 == 0 and t[:len(t) - temp].replace('a', '') == t[-temp:]:
	print(t[:-temp])
else:
	print(':(')


original = list(input())
modified = original[:]
s = []
index = 0
for j in range(len(original)):
	if original[j] == 'a':
		index = j
	else:
		s.append(original[j])
if original.count('a') == len(original):
	print(''.join(original))
else:
	last = original[index + 1:]
	s = s[:len(s) - len(last)]
	if len(s) > len(last):
		print(':(')
	else:
		diff = len(last) - len(s)
		if diff % 2 == 0:
			s.extend(last[0:diff // 2])
			last = last[diff // 2:]
			if s == last:
				print(''.join(original[:index + 1 + diff // 2]))
			else:
				print(':(')
		else:
			print(':(')


t = input()
count_a = t.count('a')
len_without_a = len(t) - count_a
if len_without_a % 2 == 0:
	length_s_prime = len_without_a // 2
	s_prime = t[-length_s_prime:]
	s_index = 0
	s_prime_index = 0
	while s_prime_index < length_s_prime:
		while t[s_index] == 'a':
			s_index += 1
		if t[s_index] != s_prime[s_prime_index]:
			break
		s_index += 1
		s_prime_index += 1
	else:
		print(t[:len(t) - length_s_prime])
		exit()
print(':(')


WRONG = ':('
t = input()
an = t.count('a')
if (len(t) - an) % 2 != 0:
	print(WRONG)
	exit()
ind = (len(t) - an) // 2 + an
s = t[:ind]
new = s + ''.join([i for i in s if i != 'a'])
if t == new:
	print(s)
else:
	print(WRONG)


t = input()
s = ''
for i in range(len(t)):
	if t[i] != 'a':
		s += t[i]
if s[:len(s) // 2] == s[len(s) // 2:] and s[len(s) // 2:] == t[len(t) - len(s) // 2:]:
	print(t[:len(t) - len(s) // 2])
else:
	print(':(')


t = input()
n = len(t)
i = 0
j = n - 1
(s, sd) = ([], [])
problem = False
while i < j and i < n and (j > -1):
	while i < n and t[i] == 'a':
		i += 1
	if i >= j:
		break
	s.append(t[i])
	sd.append(t[j])
	i += 1
	j -= 1
if i == j:
	if t[i] == 'a':
		i += 1
	else:
		problem = True
x = ''.join(s)
y = ''.join(sd[::-1])
if x == y and (not problem):
	print(t[:i])
else:
	print(':(')


a = input()
b = ''.join([i for i in a if i != 'a'])
outlier = b[:round(len(b) / 2)]
if a[len(a) - len(outlier):] == outlier:
	s = a[:len(a) - len(outlier)]
	if ''.join([i for i in s if i != 'a']) == a[len(a) - len(outlier):]:
		print(s)
	else:
		print(':(')
else:
	print(':(')


t = input()
segs = t.split('a')
ss = ''.join(segs)
total_ss = len(ss)
border = len(ss) // 2
if len(ss) % 2 != 0 or ss[:border] != ss[border:] or len(segs[-1]) < border:
	print(':(')
else:
	print(t[:len(t) - border])


s = input()
n = int(len(s))
i = s.count('a')
q = (n - i) // 2
w = s[:q + i]
ss = s[q + i:]
p = ''.join([i for i in w if i != 'a'])
if p == ss:
	print(w)
else:
	print(':(')


s = input()
n = len(s)
t = s.replace('a', '')
l = len(t)
if l == 0:
	print(s)
elif l % 2 == 0 and t[:l // 2] == t[l // 2:] and (t[l // 2:] == s[n - l // 2:]):
	print(s[:-l // 2])
else:
	print(':(')


s = input()
string1 = ''
string2 = ''
flag = 0
n = len(s)
for i in range(n):
	string1 += s[i]
	if s[i] != 'a':
		string2 += s[i]
	if string1 + string2 == s:
		flag = 1
		break
if flag == 0:
	print(':(')
else:
	print(string1)


t = input()
l = len(t)
n = t.count('a')
other = l - n
if other % 2 != 0:
	print(':(')
else:
	o = int(other / 2)
	s = t[:n + o]
	s2 = t[n + o:]
	if s.replace('a', '') == s2:
		print(s)
	else:
		print(':(')


s = input()
x = ''
for i in s:
	if i != 'a':
		x += i
if len(x) % 2:
	print(':(')
else:
	p = x[:len(x) // 2]
	q = x[len(x) // 2:]
	if p == q:
		if s[:s.rfind(p)] + p == s:
			print(s[:s.rfind(p)])
		else:
			print(':(')
	else:
		print(':(')


t = input()
c = 0
n = len(t)
s = ''
a = ':('
for i in range(n):
	if i - c == n - i:
		if s == t[i:]:
			a = t[:i]
			break
	if t[i] == 'a':
		c += 1
	if t[i] != 'a':
		s += t[i]
if c == n:
	print(t)
else:
	print(a)


s = input()
noa = s.replace('a', '')
if len(noa) % 2 != 0:
	print(':(')
elif noa[:len(noa) // 2] != noa[len(noa) // 2:]:
	print(':(')
elif s[len(s) - len(noa[len(noa) // 2:]):] != noa[len(noa) // 2:]:
	print(':(')
else:
	print(s[:len(s) - len(noa[len(noa) // 2:])])


s = input()
a = s[::-1]
x = a.find('a')
if x != -1:
	p = ''
	x = len(s) - 1 - x
	ans = ''
	for i in range(x + 1):
		if s[i] != 'a':
			p += s[i]
		ans += s[i]
	f = 0
	cur = ''
	x += 1
	while x <= len(s) - 1:
		cur = s[x:]
		if p == cur:
			print(ans)
			f = 1
			break
		p += s[x]
		ans += s[x]
		x += 1
	if f == 0:
		if p == cur:
			print(ans)
		else:
			print(':(')
else:
	n = len(s)
	if n & 1:
		print(':(')
	else:
		(a, b) = (s[:n // 2], s[n // 2:])
		if a == b:
			print(a)
		else:
			print(':(')


s = input()
b = ''
l = len(s)
flag = 0
for i in range(l):
	if s[i] != 'a':
		b = b + s[i]
l1 = len(b)
if l1 % 2 == 0:
	t = l1 // 2
	d = b[:t]
	c = s[l - t:]
	for j in range(t):
		if c[j] != d[j] or c[j] == 'a':
			flag = 1
			break
else:
	flag = 1
if flag == 0:
	print(s[:l - t])
else:
	print(':(')


def main():
	s = list(input())
	l = len(s)
	pos = -1
	for i in range(l - 1, -1, -1):
		if s[i] == 'a':
			pos = i
			break
	other = 0
	s1 = []
	for i in range(pos):
		if s[i] != 'a':
			other += 1
			s1.append(s[i])
	if other > l - pos - 1:
		print(':(')
	elif other == l - pos - 1:
		if ''.join(s1) == ''.join(s[pos + 1:l]):
			print(''.join(s[0:pos + 1]))
		else:
			print(':(')
	else:
		if pos != -1:
			j = 1
		else:
			j = 0
			pos = 0
		while other < l - pos - 1 - j:
			other += 1
			s1.append(s[pos + j])
			j += 1
		if ''.join(s1) == ''.join(s[pos + j:l]):
			print(''.join(s[0:pos + j]))
		else:
			print(':(')
main()


s = input()
s1 = ''
a = 0
for i in s:
	if i == 'a':
		a -= -1
	else:
		s1 += i
if len(s1) % 2:
	print(':(')
	exit()
t = len(s1) // 2
ch = 1
x = len(s) - 1
for i in range(t - 1, -1, -1):
	if s1[i] != s[x]:
		ch = 0
		break
	x += -1
if ch:
	for i in range(len(s) - t):
		print(s[i], end='')
else:
	print(':(')


a = input('')
len_a = 0
len_tot = 0
flg = False
no_a = dict()
mid = 0
for c in a:
	if c != 'a':
		no_a[len_a] = len_tot
		len_a += 1
	len_tot += 1
if len_a == 0:
	pass
elif len_a % 2 != 0:
	flg = True
elif a[len_tot - 1] == 'a':
	flg = True
else:
	mid = len_a // 2
	mid_index = no_a[mid]
	for i in range(mid_index):
		if a[i] != 'a':
			if a[i] != a[mid_index]:
				flg = True
				break
			mid_index += 1
if flg:
	print(':(')
else:
	len_s = len_tot - mid
	print(a[:len_s])


def fun(string):
	remove = ''
	index = []
	for i in range(n):
		if string[i] != 'a':
			remove += string[i]
			index.append(i)
	if remove == '':
		return string
	if string[-1] == 'a':
		return ':('
	if len(remove) % 2 != 0:
		return ':('
	if remove[:int(len(remove) / 2)] == remove[int(len(remove) / 2):] and remove[:int(len(remove) / 2)] == string[-int(len(remove) / 2):]:
		x = index[int(len(remove) / 2) - 1] + 1
		check = string[:x]
		while x < n and string[x] == 'a':
			check += string[x]
			x += 1
		return check
	return ':('
string = input()
n = len(string)
print(fun(string))


def sh(s):
	rez = ''
	for ch in s:
		if ch != 'a':
			rez += ch
	return rez
s = input()
ssh = sh(s)
k = len(ssh)
if k % 2:
	print(':(')
else:
	r = s[:len(s) - k // 2]
	if r + sh(r) == s:
		print(r)
	else:
		print(':(')


a = input()[::-1]
(b, i) = (a.replace('a', ''), 0)
for i in range(len(a)):
	if a[:i] == b[i:]:
		print(a[i:][::-1])
		break
else:
	print(':(')


def user99():
	t = input()
	s = ''.join(['' if i == 'a' else i for i in t])
	n = len(s)
	if n % 2 == 0 and s[:n // 2] == s[n // 2:] and t.endswith(s[:n // 2]):
		print(t[:len(t) - n // 2])
	else:
		print(':(')
user99()


i = input()
n = list(set(i))
if len(n) == 1 and n[0] == 'a':
	print(i)
else:
	s_dash = str(i.translate({ord('a'): None}))
	m = list(set(s_dash))
	last = {'s': '', 's_Dash': ''}
	for j in range(len(m)):
		count_char = i.count(m[j])
		if count_char % 2 != 0:
			print(':(')
			exit()
		else:
			last['s'] += count_char // 2 * str(m[j])
			last['s_Dash'] += count_char // 2 * str(m[j])
	if last['s'] == last['s_Dash']:
		b = i[:-len(last['s_Dash'])]
		nc = str(b.translate({ord('a'): None}))
		nc2 = i[len(i) - len(last['s_Dash']):]
		if nc == nc2:
			print(b)
		else:
			print(':(')
	else:
		print(':(')


s = input()
n = s.count('a')
idx = (len(s) - n) // 2
n_s = s[:n + idx]
n_sp = s[n + idx:]
j = 0
cond = True
for i in n_s:
	if i != 'a':
		if i != n_sp[j]:
			cond = False
			break
		j += 1
if cond == False or (len(s) - n) % 2 != 0:
	print(':(')
else:
	print(n_s)


import sys, math, queue
MOD = 10 ** 9 + 7
s = list(input())
x = []
a = 0
for c in s:
	if c != 'a':
		x.append(c)
	else:
		a += 1
if x[:len(x) // 2] == x[len(x) // 2:]:
	if 'a' in s[len(x) // 2 + a:]:
		print(':(')
	else:
		print(''.join(s[:len(x) // 2 + a]))
else:
	print(':(')


def solution(t):
	no_a = t.replace('a', '')
	s_ = no_a[:len(no_a) // 2]
	if s_ + s_ == no_a and t.endswith(s_):
		return t[:-len(s_) or None]
	else:
		return ':('
print(solution(input()))


def solve(t):
	lt = len(t)
	ss = t.replace('a', '')
	lss = len(ss)
	if lss % 2:
		return ':('
	s1 = t[:lt - lss // 2]
	s2 = t[lt - lss // 2:]
	s3 = s1.replace('a', '')
	if s2 == s3:
		return s1
	else:
		return ':('
t = input()
print(solve(t))


t = list(input())
ss = []
for c in t:
	if c != 'a':
		ss.append(c)
sd = ss[len(ss) // 2:]
if ss[:len(ss) // 2] != sd:
	print(':(')
	exit()
s = t[:len(t) - len(sd)]
sd1 = []
for c in s:
	if c != 'a':
		sd1.append(c)
if sd1 == sd:
	print(''.join(s))
else:
	print(':(')


n = input()
s = n.replace('a', '')
if s == '':
	print(n)
else:
	temp = len(s) // 2
	if s[:temp] == s[temp:]:
		if n[len(n) - temp:] == s[temp:]:
			print(n[:len(n) - temp])
		else:
			print(':(')
	else:
		print(':(')


def solve():
	string = list(input())
	blah = list(filter(lambda x: x != 'a', string))
	if len(blah) % 2 != 0:
		return False
	if blah[:len(blah) // 2] != blah[len(blah) // 2:]:
		return False
	i = len(blah) // 2
	x = string[:]
	while len(x) > 0 and x[-1] != 'a' and (i > 0):
		x.pop()
		i -= 1
	y = list(filter(lambda y: y != 'a', x))
	if y != blah[:len(blah) // 2]:
		return False
	return ''.join(x)
x = solve()
if x == False:
	print(':(')
else:
	print(x)


import sys
s = input()
t = s.replace('a', '')
if t[0:len(t) // 2] != t[len(t) // 2:]:
	print(':(')
	sys.exit()
if 'a' in s[len(s) - len(t) // 2:]:
	print(':(')
	sys.exit()
print(s[0:len(s) - len(t) // 2])


arr = input()
print(arr[:int(len(arr) - int(len(arr.replace('a', '')) / 2))] if arr[int(len(arr) - int(len(arr.replace('a', '')) / 2)):] == arr.replace('a', '')[int(len(arr.replace('a', '')) / 2):] and arr.replace('a', '')[:int(len(arr.replace('a', '')) / 2)] == arr.replace('a', '')[int(len(arr.replace('a', '')) / 2):] else ':(')


def finish():
	print(':(')
	exit(0)
t = input()
count_a = t.count('a')
l = len(t)
if (l - count_a) % 2 == 1:
	finish()
len_s = l - (l - count_a) // 2
if len_s <= 0:
	finish()
if t[:len_s].replace('a', '') != t[len_s:]:
	finish()
print(t[:len_s])


s = input()
a = s.replace('a', '')
l = len(a)
if l == 0:
	print(s)
elif l % 2 != 0:
	print(':(')
elif a[:l // 2] == a[l // 2:]:
	r = len(s) - len(a[l // 2:])
	if s[:r] + a[l // 2:] == s:
		print(s[:r])
	else:
		print(':(')
else:
	print(':(')


s = input()
n = len(s)
s2 = ''
for i in range(n):
	if s[i] != 'a':
		s2 = s2 + s[i]
	if s[0:i + 1] + s2 == s:
		print(s[0:i + 1])
		exit(0)
print(':(')


def f(s):
	res = ''
	for c in s:
		if c != 'a':
			res += c
	return res
s = input()
n = len(s)
ss = f(s)
nn = len(ss)
if nn % 2 == 1:
	print(':(')
	exit(0)
if ss[:nn // 2] != ss[nn // 2:]:
	print(':(')
	exit(0)
cnt = 0
for i in range(n - 1, -1, -1):
	if s[i] == 'a':
		break
	cnt += 1
if cnt < nn // 2:
	print(':(')
	exit(0)
print(s[:n - nn // 2])


s = input()
cur = ''
for i in range(len(s)):
	if s[i] != 'a':
		cur += s[i]
	if len(cur) == len(s) - i - 1:
		if s[i + 1:] == cur:
			print(s[:i + 1])
			break
else:
	print(':(')


s = input()
l = s.count('a')
c = len(s) - l
if c == 0:
	print(s)
elif c % 2:
	print(':(')
else:
	c //= 2
	t = [i for i in s[:-c] if i != 'a']
	if ''.join(t) == s[-c:]:
		print(s[:-c])
	else:
		print(':(')


t = input()
tt = t.replace('a', '')
if len(tt) % 2 == 1 or (len(tt) > 0 and 'a' in t[-len(tt) // 2:]):
	print(':(')
else:
	(i, j) = (0, len(tt) // 2)
	fail = False
	while j < len(tt):
		if tt[i] != tt[j]:
			print(':(')
			fail = True
			break
		i += 1
		j += 1
	if not fail:
		print(t[:len(t) - len(tt) // 2])


s = list(input())
conta_a = 0
conta_nao_a = 0
for l in s:
	if l == 'a':
		conta_a += 1
	else:
		conta_nao_a += 1
if conta_nao_a % 2 != 0:
	print(':(')
else:
	meio = conta_nao_a // 2
	sem_a = s[len(s) - meio:len(s)]
	sem_a_comeco = list(filter(lambda x: x != 'a', s[0:len(s) - meio]))
	if 'a' in sem_a:
		print(':(')
	elif sem_a == sem_a_comeco:
		print(''.join(s[0:len(s) - meio]))
	else:
		print(':(')


import math
import bisect
import heapq
from collections import defaultdict

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, x, y) = egcd(b % a, a)
		return (g, y - b // a * x, x)

def mulinv(b, n):
	(g, x, _) = egcd(b, n)
	if g == 1:
		return x % n
primes = []

def isprime(n):
	for d in range(2, int(math.sqrt(n)) + 1):
		if n % d == 0:
			return False
	return True

def argsort(ls):
	return sorted(range(len(ls)), key=ls.__getitem__)

def f(p=0):
	if p == 1:
		return map(int, input().split())
	elif p == 2:
		return list(map(int, input().split()))
	else:
		return int(input())
t = input()
n = len(t)
w = t.replace('a', '')
nw = len(w)
if nw % 2 != 0:
	print(':(')
	exit()
else:
	mid = nw // 2
for i in range(mid):
	if w[i] != w[mid + i]:
		print(':(')
		exit()
count = mid
res = ''
counta = 0
for i in range(n):
	if t[i] == 'a':
		counta = 0
	else:
		counta += 1
if counta < mid:
	print(':(')
else:
	i = 0
	if count == 0:
		print(t)
	else:
		while count != 0 or i < n - counta:
			if t[i] != 'a':
				count -= 1
			res += t[i]
			i += 1
		print(res)


def run():
	string = input()
	string_prime = len(string) - string.count('a')
	if string_prime == 0:
		return string
	if string_prime % 2 != 0:
		return ':('
	half = string_prime // 2
	stringR = string[::-1]
	c1 = stringR[:half]
	c2 = [c for c in stringR[half:] if c != 'a']
	if c1 != ''.join(c2):
		return ':('
	return stringR[half:][::-1]
print(run())


s = input()
c = 0
temp = ''
stp = 0
for i in range(len(s) - 1, -1, -1):
	if s[i] == 'a':
		break
	else:
		temp += s[i]
		stp = i
temp2 = temp[::-1]
check = ''
for i in range(0, i):
	if s[i] == 'a':
		continue
	else:
		check += s[i]
kk = 0
while len(temp2) > len(check):
	kk += 1
	check += temp2[0]
	temp2 = temp2[1:]
l = len(set(list(s)))
if len(temp) == 0 and l == 1:
	print(s)
elif check == temp2:
	print(s[:stp + kk])
else:
	print(':(')


ss = input()
lastA = ss.rfind('a')
if lastA != -1:
	compuls = ss[:lastA]
	tp = compuls.replace('a', '')
	if len(tp) > len(ss[lastA + 1:]) or (len(tp) + len(ss[lastA + 1:])) % 2 == 1:
		print(':(')
	else:
		ss1 = tp + ss[lastA + 1:]
		(firstpart, secondpart) = (ss1[:len(ss1) // 2], ss1[len(ss1) // 2:])
		if firstpart == secondpart:
			print(ss[:len(ss) - len(secondpart)])
		else:
			print(':(')
elif len(ss) % 2 == 0:
	(firstpart, secondpart) = (ss[:len(ss) // 2], ss[len(ss) // 2:])
	if firstpart == secondpart:
		print(firstpart)
	else:
		print(':(')
else:
	print(':(')


import math

def f(s):
	return s + s.replace('a', '')
s = input()
n = len(s)
try:
	last_a = s.rindex('a')
except ValueError:
	if n % 2 != 0 or s[:n // 2] != s[n // 2:]:
		print(':(')
	else:
		print(s[:n // 2])
	exit()
a_less_len = last_a - s.count('a') + 1
tail_len = n - last_a - 1
if a_less_len > tail_len:
	print(':(')
	exit()
a_less_i = last_a + 1
if a_less_len < tail_len:
	diff = tail_len - a_less_len
	if diff % 2 != 0:
		print(':(')
		exit()
	a_less_i += diff // 2
if f(s[:a_less_i]) == s:
	print(s[:a_less_i])
else:
	print(':(')


t = input()
s2 = t.replace('a', '')
if s2[:len(s2) // 2] != s2[len(s2) // 2:]:
	print(':(')
elif s2 == '':
	print(t)
else:
	l = list(s2[len(s2) // 2:])[::-1]
	for i in range(len(t) - 1, -1, -1):
		if t[i] == l[0]:
			l.pop(0)
		if t[i] == 'a':
			print(':(')
			exit()
		if not l:
			print(t[:i])
			break


T = input()
S = ''
Na = 0
Nx = 0
for i in T:
	if i != 'a':
		S += i
if len(S) % 2 == 0 and S[0:len(S) // 2] == T[len(T) - len(S) // 2:]:
	print(T[0:len(T) - len(S) // 2])
else:
	print(':(')


a = list(input())
aa = a.copy()
n = len(a)
count = 0
bb = []
for i in range(n):
	if a[i] != 'a':
		bb.append(a[i])
b = len(bb)
ans = 0
if b % 2 == 0:
	s = aa[:n - b // 2]
	temp1 = s.copy()
	sprime = s.copy()
	bc = 0
	bcc = []
	for i in range(len(sprime)):
		if sprime[i] != 'a':
			bcc.append(sprime[i])
	s.extend(bcc)
	if s == aa:
		ans = 1
if ans == 0:
	print(':(')
else:
	print(''.join(temp1))


import sys
from bisect import bisect_left, bisect_right, insort
from collections import deque, Counter
from math import gcd, sqrt, factorial, ceil, log10, log2
from itertools import permutations
from heapq import heappush, heappop, heapify
inf = float('inf')
mod = 1000000007

def factorial_p(n, p):
	ans = 1
	if n <= p // 2:
		for i in range(1, n + 1):
			ans = ans * i % p
	else:
		for i in range(1, p - n):
			ans = ans * i % p
		ans = pow(ans, p - 2, p)
		if n % 2 == 0:
			ans = p - ans
	return ans

def nCr_p(n, r, p):
	ans = 1
	while n != 0 or r != 0:
		(a, b) = (n % p, r % p)
		if a < b:
			return 0
		ans = ans * factorial_p(a, p) * pow(factorial_p(b, p), p - 2, p) * pow(factorial_p(a - b, p), p - 2, p) % p
		n //= p
		r //= p
	return ans

def prime_sieve(n):
	flag = n % 6 == 2
	sieve = bytearray((n // 3 + flag >> 3) + 1)
	for i in range(1, int(n ** 0.5) // 3 + 1):
		if not sieve[i >> 3] >> (i & 7) & 1:
			k = 3 * i + 1 | 1
			for j in range(k * k // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
			for j in range(k * (k - 2 * (i & 1) + 4) // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
	return sieve

def prime_list(n):
	res = []
	if n > 1:
		res.append(2)
	if n > 2:
		res.append(3)
	if n > 4:
		sieve = prime_sieve(n + 1)
		res.extend((3 * i + 1 | 1 for i in range(1, (n + 1) // 3 + (n % 6 == 1)) if not sieve[i >> 3] >> (i & 7) & 1))
	return res

def binary(number):
	result = 0
	while number:
		result = result + 1
		number = number & number - 1
	return result

def is_prime(n):
	if n < 5 or n & 1 == 0 or n % 3 == 0:
		return 2 <= n <= 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			p = p * p % n
			if p == n - 1:
				break
		else:
			return False
	return True

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
string = input()
n = len(string)
noa = 0
noo = 0
for i in string:
	if i == 'a':
		noa += 1
	else:
		noo += 1
if noo & 1:
	print(':(')
	exit()
los = noo // 2 + noa
s = []
for i in range(los):
	s.append(string[i])
sd = []
for i in s:
	if i != 'a':
		sd.append(i)
flag = 0
j = 0
for i in range(los, n):
	if string[i] != sd[j]:
		flag = 1
		break
	j += 1
if flag == 0:
	print(''.join(s))
else:
	print(':(')


s = input()
a_cnt = s.count('a')
if (len(s) - a_cnt) % 2 != 0:
	print(':(')
else:
	i = 0
	m = a_cnt + (len(s) - a_cnt) // 2
	k = m
	while i < m and s[i] == 'a':
		i += 1
	while i < m and k < len(s):
		if s[i] != s[k]:
			break
		k += 1
		i += 1
		while i < m and s[i] == 'a':
			i += 1
	if i < m or k < len(s):
		print(':(')
	else:
		print(s[0:m])


from collections import defaultdict as dd
s = input()
d = dd(int)
c = dd(int)
v = dd(int)
for i in s:
	if i != 'a':
		d[i] += 1
		c[i] += 1
lol = 0
for i in d:
	if d[i] % 2 != 0:
		lol = 1
		break
if lol == 0:
	ind = len(s)
	for i in range(len(s) - 1, -1, -1):
		if s[i] != 'a':
			c[s[i]] -= 1
			if c[s[i]] > d[s[i]] // 2:
				continue
			else:
				if v[s[i]] == 1:
					break
				v[s[i]] = 1
				ind = i
	s1 = s[:ind]
	s2 = s[ind:]
	s3 = ''
	for i in s1:
		if i != 'a':
			s3 += i
	if s3 == s2:
		print(s1)
	else:
		print(':(')
else:
	print(':(')


s = input()
leta = 0
index = 0
i = 0
for c in s:
	if c == 'a':
		leta += 1
		index = i
	i += 1
let_before = index + 1 - leta
let_after = len(s) - index - 1
if let_before > let_after:
	print(':(')
elif (let_after - let_before) % 2 != 0:
	print(':(')
else:
	step = (let_after - let_before) // 2
	if s[:index + step + 1].replace('a', '') == s[index + step + 1:]:
		print(s[:index + step + 1])
	else:
		print(':(')


s = input()
n = 0
for ch in s:
	if ch == 'a':
		n += 1
try:
	if (len(s) - n) % 2 != 0:
		raise RuntimeError()
	j = (len(s) - n) // 2 + n
	i = 0
	k = j
	while i < k:
		if s[i] == 'a':
			i += 1
			continue
		if s[i] != s[j]:
			raise RuntimeError()
		i += 1
		j += 1
	print(s[:k])
except RuntimeError:
	print(':(')


s = input()
x = (len(s) - s.count('a')) // 2
t = s[len(s) - x:]
if s[:len(s) - x].replace('a', '') == t:
	print(s[:len(s) - x])
else:
	print(':(')


t = input()
s = t.replace('a', '')
n = len(s)
if n % 2 == 0:
	flag = 1
	n2 = n // 2
	for i in range(n // 2):
		if s[i] != s[n2 + i]:
			flag = 0
			break
	if flag:
		n = len(t)
		n2 = n - n2 - 1
		for i in range(n - 1, n2, -1):
			if t[i] == 'a':
				flag = 0
				break
		if flag:
			print(t[:n2 + 1])
		else:
			print(':(')
	else:
		print(':(')
else:
	print(':(')


import sys
input = sys.stdin.readline
t = input().strip()
n = (len(t) - t.count('a')) // 2
if t[:len(t) - n].replace('a', '') == t[len(t) - n:]:
	print(t[:len(t) - n])
else:
	print(':(')


import collections
import math
t = list(input())
tt = list(filter(lambda a: a != 'a', t))
tt = tt[:int(len(tt) / 2)]
ttc = collections.Counter(tt).values()
tc = collections.Counter(t)
if 'a' in tc:
	tc.pop('a')
tcc = collections.Counter(tc).values()
t = ''.join(t)
tt = ''.join(tt)
if sum(tcc) == sum(ttc) * 2 and tt in t[len(t) - len(tt):]:
	temp = t[::-1]
	tt = tt[::-1]
	temp = temp.replace(tt, '', 1)
	temp = temp[::-1]
	print(temp)
else:
	print(':(')


s = list(input().strip())
n = len(s)
if 'a' not in s:
	if n & 1:
		print(':(')
	else:
		m = n // 2
		if s[:m] == s[m:]:
			print(''.join(s[:m]))
		else:
			print(':(')
else:
	y = []
	for i in s:
		if i != 'a':
			y.append(i)
	a = 0
	for i in range(n):
		if s[i] == 'a':
			a = i
	m = len(y)
	if m & 1:
		print(':(')
	else:
		x = m // 2
		if y[:x] == y[x:]:
			z = s.count('a')
			if a >= x + z:
				print(':(')
			else:
				print(''.join(s[:x + z]))
		else:
			print(':(')


s = input().strip()
s1 = s.split('a')
s2 = ''.join(s1)
if s2 == '':
	print(s)
else:
	print(s[:len(s) - len(s2) // 2] if len(s2) % 2 == 0 and s2[:len(s2) // 2] == s1[-1][len(s1[-1]) - len(s2) // 2:] else ':(')


def aRemoved(s):
	newstr = s.replace('a', '')
	return newstr
st = input()
flag = 0
new = aRemoved(st)
if len(new) != 0:
	y = len(new) // 2
	if len(new) % 2 == 1:
		print(':(')
	elif new[0:y] == new[y:len(new)] and aRemoved(st[len(st) - y:len(st)]) == st[len(st) - y:len(st)]:
		dd = len(st) - y
		if dd != 0:
			print(st[0:dd])
	else:
		print(':(')
elif len(new) == 0:
	print(st)


t = input()
s = ''
for i in t:
	if i != 'a':
		s += i
if len(s) % 2 == 0:
	if s[:len(s) // 2] == s[len(s) // 2:]:
		if t[len(t) - len(s) // 2:] == s[len(s) // 2:]:
			print(t[:len(t) - len(s) // 2])
		else:
			print(':(')
	else:
		print(':(')
else:
	print(':(')


S = input()
a = S.count('a')
ls = (len(S) - a) // 2 + a
s1 = S[:ls]
s2 = S[ls:]
if (len(S) - a) % 2 != 0 or 'a' in s2:
	print(':(')
else:
	f = []
	for t in s1:
		if t != 'a':
			f += [t]
	if f != list(s2):
		print(':(')
	else:
		print(s1)


a = input()
b = ''.join(filter(lambda x: x != 'a', a))
n = len(b)
h = n // 2
if n % 2 or b[:h] * 2 != b or a[len(a) - h:] != b[:h]:
	print(':(')
else:
	print(a[:len(a) - h])


s = input()
x = ''
d = ''
e = True
for i in range(len(s)):
	x += s[i]
	if s[i] != 'a':
		d += s[i]
	if x + d == s:
		print(x)
		e = False
		break
if e:
	print(':(')


s = input()
d = []
for i in s:
	if i != 'a':
		d.append(i)
mid = len(s) - len(d) // 2
if d[:len(d) // 2] != d[len(d) // 2:] or 'a' in s[mid:]:
	print(':(')
	exit(0)
print(s[:mid])


s = input()
ss = s.replace('a', '')
print(s if not len(ss) else s[:-len(ss) // 2] if not len(ss) % 2 and ss[:len(ss) // 2] == s[-len(ss) // 2:] else ':(')


s = input()
s1 = ''
if s.count('a') == len(s):
	print(s)
else:
	for ch in s:
		if ch != 'a':
			s1 += ch
	if len(s1) % 2 != 0:
		print(':(')
	else:
		s2 = s1[:len(s1) // 2]
		s4 = s1[len(s1) // 2:]
		if s2 != s4:
			print(':(')
		else:
			s3 = ''
			s5 = ''
			count = s.count('a')
			flag = False
			for ch in s:
				if s5 == s4 and count == 0:
					flag = True
					break
				if ch == 'a':
					count -= 1
				else:
					s5 += ch
				s3 += ch
			if flag:
				print(s3)
			else:
				print(':(')


s = input()
k = (len(s) - s.count('a')) // 2
b = s[:len(s) - k]
c = s[len(s) - k:]
f = ''.join(map(str, b.split('a')))
if f == c:
	print(b)
else:
	print(':(')


s = input()
l = []
for i in s:
	if i != 'a':
		l.append(i)
n = len(l)
if n == 0 or (n % 2 == 0 and l[:n // 2] == l[n // 2:] and (s[-n // 2:] == ''.join(l[:n // 2]))):
	print(s[:len(s) - n // 2])
else:
	print(':(')


s = list(input())
n = len(s)
cout = s.count('a')
index = n
counter = i = j = 0
timer = []
if (n - cout) % 2 == 0:
	for item in s:
		if item != 'a':
			if counter < (n - cout) // 2:
				timer.append(item)
				counter += 1
			else:
				if i == 0:
					index = j
				if item != timer[i]:
					print(':(')
					exit()
				i += 1
		elif i > 0:
			print(':(')
			exit()
		j += 1
	print(*s[:index], sep='')
else:
	print(':(')


t = input()
removed = t.replace('a', '')
ds = removed[int(len(removed) / 2):]
s = t[:len(t) - len(ds)]
if len(removed) % 2 == 1 or s.replace('a', '') != ds:
	print(':(')
else:
	print(s)


import sys
t = input()
tool = len(t)
_2S = t.replace('a', '')
e = len(_2S)
if e % 2 != 0:
	print(':(')
	exit()
if _2S[:e // 2] != _2S[e // 2:]:
	print(':(')
	exit()
if t[tool - e // 2:] == _2S[:e // 2]:
	print(t[:tool - e // 2])
else:
	print(':(')


s = str(input())
x = s.replace('a', '')
if x == '':
	print(s)
	exit()
if x[:len(x) // 2] != x[len(x) // 2:]:
	print(':(')
else:
	c = 0
	ans = []
	for i in s:
		if c < len(x) // 2:
			ans.append(i)
		if i != 'a':
			c += 1
		if c >= len(x) // 2 and i == 'a':
			ans.append(i)
	y = ''
	r = ''
	if y.join(ans) + r.join(ans).replace('a', '') != s:
		print(':(')
		exit()
	for i in ans:
		print(i, end='')


import sys

class Main:

	def __init__(self):
		self.buff = None
		self.index = 0

	def next(self):
		if self.buff is None or self.index == len(self.buff):
			self.buff = sys.stdin.readline().split()
			self.index = 0
		val = self.buff[self.index]
		self.index += 1
		return val

	def next_int(self):
		return int(self.next())

	def solve(self):
		ss = self.next()
		ca = ss.count('a')
		l2 = (len(ss) - ca) // 2
		l1 = len(ss) - l2
		if list(filter(lambda x: x != 'a', ss[:l1])) == list(filter(lambda x: True, ss[l1:])):
			print(ss[:l1])
		else:
			print(':(')
Main().solve()


s = input('')
if len(s) == s.count('a'):
	print(s)
else:
	n = len(s)
	cnt = s.count('a')
	if (n - cnt) % 2:
		print(':(')
	else:
		t = s[0:cnt + (n - cnt) // 2]
		ans = t
		for i in range(len(t)):
			if t[i] != 'a':
				ans += t[i]
		if ans == s:
			print(t)
		else:
			print(':(')


a = str(input())
b = len(a)
c = 0
for i in range(b):
	if a[i] != 'a':
		c = c + 1
if c % 2 == 1:
	print(':(')
	exit()
q = a[::-1]
w = c // 2
for i in range(w):
	if q[i] == 'a':
		print(':(')
		exit()
e = a.replace('a', '')
if e[:w] != e[w:]:
	print(':(')
	exit()
a = a[::-1]
a = a[w:]
a = a[::-1]
print(a)


s = input()
cnta = len(s.split('a')) - 1
len_no_a = len(s) - cnta
if len_no_a % 2 == 1:
	print(':(')
	exit(0)
len_no_a //= 2
then_1 = s[:len(s) - len_no_a]
then_2 = s[len(s) - len_no_a:len(s)]
if ''.join(then_1.split('a')) != then_2:
	print(':(')
else:
	print(then_1)


from sys import exit

def no_As(s):
	new_s = ''
	for i in s:
		if i != 'a':
			new_s += i
	return new_s
s = input()
n = len(s)
num_a = s.count('a')
x = n - num_a
if x % 2 == 1:
	print(':(')
	exit(0)
x //= 2
if x == 0:
	print(s)
	exit(0)
second_part = s[-x:]
first_part = s[:x + num_a]
if no_As(first_part) == second_part:
	print(first_part)
	exit(0)
print(':(')


import sys
s = input()

def no():
	print(':(')
	sys.exit(0)
raw = s[:]
if 'a' in s:
	raw = s[s.rindex('a') + 1:]
fs = s[:len(s) - len(raw)]
t_ans = fs[:]
fs = fs.replace('a', '')
if len(fs) > len(raw):
	no()
comb = fs + raw
if len(comb) % 2 or comb[:len(comb) // 2] != comb[len(comb) // 2:]:
	no()
need = len(comb) // 2 - len(fs)
print(t_ans + raw[:need])


s = input()
s1 = ''
s2 = ''
r = 0
n = len(s)
for i in range(n):
	s1 = s1 + s[i]
	if s[i] != 'a':
		s2 = s2 + s[i]
	if s1 + s2 == s:
		r = 1
		break
if r == 0:
	print(':(')
else:
	print(s1)


t = input()
k = 0
s1 = ''
s2 = ''
for i in range(0, len(t)):
	if t[i] == 'a':
		k = k + 1
lens = int((len(t) + k) / 2)
ns = t[0:lens]
for i in range(0, lens):
	if ns[i] != 'a':
		s1 = s1 + ns[i]
for i in range(lens, len(t)):
	s2 = s2 + t[i]
if s2 == s1:
	print(ns)
else:
	print(':(')


s = input()
n = len(s)
ans = ''
for a in s:
	if a != 'a':
		ans += a
m = len(ans)
if m % 2 != 0 or ans[0:m // 2] != ans[m // 2:m] or ans[0:m // 2] != s[n - m // 2:n]:
	print(':(')
else:
	print(s[0:n - m // 2])


t = input()
z = t.count('a')
q = (len(t) - z) // 2
s = t[:q + z]
ss = t[q + z:]
p = ''.join([i for i in s if i != 'a'])
if p == ss:
	print(s)
else:
	print(':(')


t = input()
s = ''
for elem in t:
	if elem != 'a':
		s += elem
if len(s) % 2 != 0:
	print(':(')
else:
	c = len(s) // 2
	if c == 0:
		print(t)
	elif s[:c] != s[c:]:
		print(':(')
	elif t[-c:] != s[c:]:
		print(':(')
	else:
		print(t[:-c])


s = input()
if list(set(s)) == ['a']:
	print(s)
elif 'a' not in s:
	if s[:len(s) // 2] == s[len(s) // 2:]:
		print(s[:len(s) // 2])
	else:
		print(':(')
else:
	left = ''
	last = s.rfind('a')
	st = ''
	for i in range(last):
		if s[i] != 'a':
			left += s[i]
	right = s[last + 1:]
	flag = 0
	if len(left) > len(right) or (len(right) - len(left)) % 2 == 1:
		flag = 1
	else:
		give = (len(right) - len(left)) // 2
		left += right[:give]
		st += right[:give]
		right = right[give:]
		if left != right:
			flag = 1
	if flag:
		print(':(')
	else:
		print(s[:last] + 'a' + st)


s = input()
import re
r = re.sub('a', '', s)
if r == 2 * r[:len(r) // 2] and (s[-len(r) // 2:].count('a') == 0 or r == ''):
	print(s[:len(s) - len(r) // 2])
else:
	print(':(')


t = input('')
q = ''
for j in range(len(t)):
	if t[j] != 'a':
		q = q + t[j]
	else:
		pass
s = len(q) // 2
o = len(t) - s
k = t[:o]
m = ''
for u in range(len(k)):
	if k[u] != 'a':
		m = m + k[u]
	else:
		pass
count = 0
if m == t[o:]:
	count = 1
if q[:s] == q[s:] and count == 1:
	print(t[:o])
else:
	print(':(')


string = str(input())
new_string = string.replace('a', '')
if string.count('a') == len(string):
	print(string)
elif len(new_string) % 2 != 0 or string[-1] == 'a':
	print(':(')
else:
	first = new_string[:len(new_string) // 2]
	second = new_string[-(len(new_string) // 2):]
	if first == second and ''.join(string.split())[-len(second):].count('a') == 0:
		print(''.join(string.split())[:-len(second)])
	else:
		print(':(')


s = input()
t = ''.join(s.split('a'))
if len(t) % 2 != 0 or t[:len(t) // 2] != t[len(t) // 2:] or (not s.endswith(t[len(t) // 2:])):
	print(':(')
else:
	print(s[:len(s) - len(t) // 2])


n = input()
s = ''
for i in n:
	if i != 'a':
		s += i
w = n[::-1]
r = len(s) // 2
if s[:r] == s[r:]:
	z = w[:r]
	if z[::-1] == s[:r]:
		x = w[r:]
		print(x[::-1])
	else:
		print(':(')
else:
	print(':(')


def amount(s):
	j = 0
	k = 0
	while True:
		a = s.find('a', j, len(s) + 1)
		if a != -1:
			k += 1
			j = a + 1
		else:
			return k
			break

def dela(s):
	res = ''
	for i in s:
		if i != 'a':
			res += i
	return res
t = input()
lsh = int(0.5 * (len(t) - amount(t)))
if -lsh < 0:
	sh = t[-lsh:]
else:
	sh = ''
s = t[:len(t) - lsh]
if dela(s) != sh:
	print(':(')
else:
	print(s)


a = input()
q = a.count('a')
if q > 0:
	e = a.rindex('a')
else:
	e = -1
t = e + 1 - q
b = 0
if (len(a) - q - t * 2) % 2 == 0:
	b = (len(a) - q - t * 2) // 2
	i = 0
	j = 0
	k = e + b + 1
	u = True
	while j < k and u == True:
		if a[j] != 'a':
			if a[j] == a[k + i]:
				i += 1
			else:
				u = False
		j += 1
	if u == True:
		print(a[:k])
	else:
		print(':(')
else:
	print(':(')


s = input()
counta = s.count('a')
xyz = (len(s) - counta) // 2
l = len(s) - xyz
if s[:l].replace('a', '') == s[l:]:
	print(s[:l])
else:
	print(':(')


def hate_a(s):
	n = s.count('a')
	c = len(s) - n
	if c % 2 == 1:
		return ':('
	else:
		t = s.replace('a', '')
		(sx1, sx2) = (t[:c // 2], t[c // 2:])
		if c == 0:
			return s
		elif sx2 == s[-(c // 2):] and sx1 == sx2:
			return s[:-(c // 2)]
		else:
			return ':('
print(hate_a(input()))


X = input()
Temp = X.replace('a', '')
if Temp[:len(Temp) // 2] != Temp[len(Temp) // 2:]:
	print(':(')
	exit()
print(':(' if 'a' in X[len(X) - len(Temp) // 2:] else X[:len(X) - len(Temp) // 2])


s = input()
ans = ''
yn = ':('
if s.count('a') == len(s):
	print(s)
else:
	for i in range(len(s)):
		if ans == s[i:]:
			yn = s[:i]
			break
		if s[i] != 'a':
			ans += s[i]
	print(yn)


t = input()
length = len(t)
count = 0
for i in t:
	if i == 'a':
		count += 1
slength = (length + count) / 2
if int(slength) == slength:
	s = t[0:int(slength)]
	s1 = ''
	for i in s:
		if i != 'a':
			s1 += i
	s2 = t[int(slength):]
	if s1 == s2:
		print(s)
	else:
		print(':(')
else:
	print(':(')


def astrip(s):
	return ''.join([char for char in s if char != 'a'])

def f(s):
	t = astrip(s)
	n = len(t)
	if n % 2 != 0:
		return ':('
	k = n // 2
	candidate = t[:-1 * k]
	if t != candidate + candidate:
		return ':('
	if s[len(s) - k:] == candidate:
		return s[:len(s) - k]
	return ':('
print(f(input()))


t = input()
n = len(t)
s1 = ''
last_index = -1
for i in range(n):
	if t[i] != 'a':
		s1 += t[i]
	else:
		last_index = i
if len(s1) % 2 or s1[:len(s1) // 2] != s1[len(s1) // 2:]:
	print(':(')
else:
	s = ''
	count = i = 0
	n1 = len(s1) // 2
	while count < n1:
		if t[i] != 'a':
			count += 1
		s += t[i]
		i += 1
	while i < n and i <= last_index:
		if t[i] == 'a':
			s += t[i]
			i += 1
		else:
			break
	if i >= last_index:
		print(s)
	else:
		print(':(')


t = input()
ln = len(t)
cnt = t.count('a')
a = ln - cnt
if a % 2 != 0:
	print(':(')
else:
	b = int(a // 2)
	s = t[:cnt + b]
	s1 = t[cnt + b:]
	if s.replace('a', '') == s1:
		print(s)
	else:
		print(':(')


s = input()
w = ''.join([c for c in s if c != 'a'])
e = w[:len(w) // 2]
if w == '':
	print(s)
elif len(w) % 2 == 0 and s.endswith(e):
	print(s[:-len(e)])
else:
	print(':(')


s = input()
a = ''
for i in s:
	if i != 'a':
		a += i
n = len(a)
if n % 2 == 0:
	if a[:n // 2] == a[n // 2:]:
		flag = 0
		for k in s[len(s) - n // 2:]:
			if k == 'a':
				flag = 1
		if flag == 0:
			print(s[:len(s) - n // 2])
		else:
			print(':(')
	else:
		print(':(')
else:
	print(':(')


s = input()
n = len(s)
t = ''
for i in range(n):
	if s[i] != 'a':
		t += s[i]
f = 1
ans = ''
if len(t) % 2 == 0:
	m = len(t) // 2
	for i in range(m):
		if t[i] != t[i + m]:
			f = 0
	i = len(t) - 1
	idx = n - 1
	while i >= m:
		if s[idx] != t[i]:
			f = 0
		i -= 1
		idx -= 1
	if f == 1:
		for i in range(idx + 1):
			ans += s[i]
else:
	f = 0
if f == 1:
	print(ans)
else:
	print(':(')


s = input().strip()
a = s.count('a')
n = len(s)
l = (a + n) // 2
word = s[:l]
gen = word + word.replace('a', '')
if gen == s:
	print(word)
else:
	print(':(')


a = input()
y = a.replace('a', '')
x = len(y)
if y[:x // 2] == a[-x // 2:]:
	print(a[:-x // 2])
elif x == 0:
	print(a)
else:
	print(':(')


t = input()
a = t.count('a')
l2 = (len(t) - a) // 2
l1 = len(t) - l2
if t[:l1].replace('a', '') == t[l1:]:
	print(t[:l1])
else:
	print(':(')


t = input()
c0 = t.count('a')
c1 = len(t) - c0
if c1 % 2 == 1:
	print(':(')
else:
	tna = t.replace('a', '')
	tx1 = tna[:c1 // 2]
	tx2 = tna[c1 // 2:]
	if c1 == 0:
		print(t)
	elif tx2 == t[-(c1 // 2):] and tx1 == tx2:
		print(t[:-(c1 // 2)])
	else:
		print(':(')


import sys
import math
import bisect

def solve(s):
	n = len(s)
	m = 0
	for a in list(s):
		if a == 'a':
			m += 1
	if (n - m) % 2 == 1:
		return ''
	t1 = s[0:+m + (n - m) // 2]
	t2 = s[+m + (n - m) // 2:]
	A = []
	for a in t1:
		if a != 'a':
			A.append(a)
	if ''.join(A) != t2:
		return ''
	return t1

def main():
	ans = solve(input())
	if len(ans) == 0:
		print(':(')
	else:
		print(ans)
main()


import sys
import copy
sys.setrecursionlimit(1000000)
s: str = input()
e: str = ''
for c in s:
	if c != 'a':
		e += c
if len(e) % 2:
	print(':(')
	exit()
a = e[:len(e) // 2]
b = e[len(e) // 2:]
if a != b:
	print(':(')
	exit()
c = s[:len(s) - len(e) // 2]
d = s[len(s) - len(e) // 2:]
if d == b:
	print(c)
else:
	print(':(')


t = input()
t_stored = t
found = False
s_p = ''
index = -1
for i in range(len(t) - 1, -1, -1):
	if t[i] == 'a':
		s_p = t[i + 1:]
		found = True
		index = i
		break
if not found:
	s_p = t[1:]
	index = 0
a_count = t.count('a')
t = t.replace('a', '')
index = index - a_count
if len(t) % 2 == 1:
	print(':(')
	quit()
elif index > len(t) // 2 - 1:
	print(':(')
	quit()
elif t[0:len(t) // 2] == t[len(t) // 2:len(t)]:
	index = len(t) // 2 - 1
else:
	print(':(')
	quit()
index = index + a_count
print(t_stored[0:index + 1])


s = input()
stack = []
for char in s:
	if char != 'a':
		stack.append(char)
if not stack:
	print(s)
	exit()
half = len(stack) // 2
if stack[:half] != stack[half:]:
	print(':(')
	exit()
else:
	tmp = ''.join(stack[:half])
	candidate = ''.join(s[:s.rfind(tmp)])
	if candidate + tmp != s:
		print(':(')
	else:
		print(candidate)


import math
s = input('')
a = []
b = []
n = len(s)
ans = 0
for i in range(len(s)):
	if not s[i] == 'a':
		a.append(s[i])
if len(a) % 2 != 0:
	ans = 1
if ans == 0:
	j = 0
	for i in range(len(a) // 2, len(a)):
		if a[i] == a[j]:
			b.append(a[i])
			j += 1
		else:
			ans = 1
			break
if ans == 0:
	j = -1
	for i in range(len(b) - 1, -1, -1):
		if b[i] != s[j]:
			ans = 1
			break
		j -= 1
if ans == 1:
	print(':(')
else:
	for i in range(n - len(b)):
		print(s[i], end='')


t = input()
A = len(t.split('a')) - 1
if (len(t) + A) % 2 == 0:
	s1 = t[(len(t) + A) // 2:]
	s = t[:(len(t) + A) // 2]
	q = ''.join(s.split('a'))
	if s1 == q:
		print(s)
	else:
		print(':(')
else:
	print(':(')


stringa = input()
ans = ''
for i in stringa:
	if i == 'a':
		continue
	ans = ans + i
if len(ans) % 2 == 1:
	print(':(')
else:
	flag = 0
	n = len(ans)
	for i in range(n // 2):
		if ans[i] != ans[n // 2 + i]:
			flag = 1
			break
	if flag == 1:
		print(':(')
	else:
		flag = 0
		count = 0
		for i in range(len(stringa) - 1, -1, -1):
			if stringa[i] == 'a':
				break
			count += 1
		if count < n // 2:
			print(':(')
		else:
			c = len(stringa)
			s = ''
			for i in range(c - n // 2):
				s = s + stringa[i]
			print(s)


import string
t = input()
if t == 'a' * len(t):
	print(t)
else:
	last = t[len(t) - 1]
	list_letters = [x for x in t if x != 'a']
	length = int(len(list_letters) / 2)
	if len(list_letters) % 2 != 0:
		print(':(')
	else:
		suffix = ''.join(list_letters[:length])
		if t.endswith(suffix) and suffix != '':
			print(t[:-len(suffix)])
		else:
			print(':(')


s = input()
nona = 0
counta = 0
esc = []
for item in s:
	if item != 'a':
		nona = nona + 1
		esc.append(item)
	else:
		counta = counta + 1
if nona % 2 != 0:
	print(':(')
else:
	test = list(s[counta + nona // 2:])
	esc = esc[0:len(esc) // 2]
	if esc == test:
		print(s[0:counta + nona // 2])
	else:
		print(':(')


string = input()
if string[-1] == 'a':
	if string.count('a') == len(string):
		print(string)
	else:
		print(':(')
else:
	start = string.rfind('a') + 1
	counter = 0
	total = string.count(string[-1])
	back = string.count(string[-1], start)
	if total % 2 != 0 or back < total / 2:
		print(':(')
	else:
		index = start
		while total / 2 != back - counter:
			if string[index] == string[-1]:
				counter += 1
			index += 1
		first_start = len(string) - 1
		second_start = index - 1
		ans = True
		while second_start >= 0 and first_start >= index:
			while string[second_start] == 'a' and second_start > 0:
				second_start -= 1
			if string[second_start] != string[first_start]:
				ans = False
				break
			second_start -= 1
			first_start -= 1
		if ans:
			if first_start >= index:
				print(':(')
			elif string[:second_start + 1].count('a') != second_start + 1:
				print(':(')
			else:
				print(string[:index])
		else:
			print(':(')


from sys import stdin

def readLine():
	return stdin.readline().strip()

def readInt():
	return int(readLine())

def readInts():
	return list(map(int, readLine().split()))

def solve(N, T):
	S = T[0]
	A = T[0] if T[0] != 'a' else ''
	B = ''
	for i in range(1, N):
		B += T[i]
	if A == B:
		return S
	for i in range(1, N):
		A += T[i] if T[i] != 'a' else ''
		if A == B[i:]:
			return T[:i + 1]
	return False

def main():
	T = readLine()
	N = len(T)
	ans = solve(N, T)
	print(':(' if ans == False else ans)
main()


t = input()
t1 = t.replace('a', '')
if t1[:len(t1) // 2] == t1[len(t1) // 2:]:
	if t[len(t) - 1] == 'a' and t.count('a') != len(t):
		print(':(')
	elif t[len(t) - len(t1) // 2:].count('a') == 0:
		print(t[:len(t) - len(t1) // 2])
	else:
		print(':(')
else:
	print(':(')


s = input()
s1 = s
s1 = s1.replace('a', '')
if len(s1) % 2 == 1 or s1[:len(s1) // 2] != s1[len(s1) // 2:]:
	print(':(')
	exit()
if s[len(s) - len(s1) // 2:] != s1[:len(s1) // 2]:
	print(':(')
	exit()
ans = ''
for i in range(len(s) - len(s1) // 2):
	ans += s[i]
print(ans)


t = input()
k = len(t)
s = ''.join([i for i in t if i != 'a'])
n = len(s)
h = n // 2
if s == '':
	print(t)
elif t[k - 1] == 'a' or n % 2 > 0:
	print(':(')
elif s[:h] != s[h:]:
	print(':(')
elif not t.endswith(s[h:]):
	print(':(')
else:
	print(t[:k - h])


t = input()
e = len(t)
w = e
f = True
for i in t[::-1]:
	if i != 'a':
		w -= 1
	else:
		f = False
		break
if f:
	if e % 2 == 0:
		if t[:e // 2] == t[e // 2:]:
			print(t[:e // 2])
			exit()
		else:
			print(':(')
			exit()
	else:
		print(':(')
	exit()
ss = ''
aa = 0
for i in range(w):
	if t[i] != 'a':
		ss += t[i]
		aa += 1
qq = e - w
if (aa + qq) % 2 != 0:
	print(':(')
else:
	rr = (aa + qq) // 2
	if aa < qq:
		y = (aa + qq) // 2 - aa
		ss += t[w:w + y]
		if ss == t[w + y:]:
			print(t[:w + y])
		else:
			print(':(')
	elif aa > qq:
		print(':(')
	elif ss == t[w:]:
		print(t[:w])
	else:
		print(':(')


def solution(s):
	drop_a_s = [el for el in s if el != 'a']
	if not drop_a_s:
		return s
	if len(drop_a_s) % 2 == 1:
		return ':('
	middle = int(len(drop_a_s) / 2)
	for i in range(middle):
		if drop_a_s[i] != drop_a_s[middle + i]:
			return ':('
	cur_i = 0
	res_i = 0
	for (i, el) in enumerate(s):
		if el == drop_a_s[cur_i]:
			cur_i += 1
			res_i = i
			if cur_i > middle:
				break
	for el in s[res_i:]:
		if el == 'a':
			return ':('
	return s[:res_i]
s1 = input()
print(solution(s1))


s = str(input())
s1 = ''
for i in range(0, len(s)):
	if s[i] != 'a':
		s1 += s[i]
n = len(s1)
if n % 2 == 0:
	half1 = s1[0:n // 2]
	half2 = s1[n // 2:]
	if half1 == half2:
		pos = 0
		ss = ''
		ss1 = ''
		for i in range(0, len(s)):
			if s[i] == 'a':
				ss += s[i]
			elif s[i] != 'a' and pos != n // 2:
				ss1 += s[i]
			if pos != n // 2 and s[i] == half1[pos]:
				ss += s[i]
				pos += 1
		if ss + ss1 == s:
			print(ss)
		else:
			print(':(')
	else:
		print(':(')
else:
	print(':(')


s = list(input())
n = len(s)
i = len(s) - 1
while i >= 0 and s[i] != 'a':
	i -= 1
f = i + 1
s1 = []
s2 = []
for j in range(0, f):
	if s[j] != 'a':
		s1.append(s[j])
if len(s1) > n - f or (len(s1) + (n - f)) % 2 != 0:
	print(':(')
else:
	m = (len(s1) + (n - f)) // 2
	tem = len(s1)
	for i in range(f, f + m - len(s1)):
		s1.append(s[i])
	s2 = s[f + m - tem:n]
	if s1[:] == s2[:]:
		print(''.join(s[:f + m - tem]))
	else:
		print(':(')


a = input()
b = a.replace('a', '')
x = len(b) // 2
if len(b) < 1:
	print(a)
else:
	print([a[:-x], ':('][b[:-x] != b[-x:] or a[-x:].count('a') > 0])


s = input()
l1 = []
for c in s:
	if c != 'a':
		l1.append(c)
if len(l1) % 2 == 0:
	flag = 0
	for i in range(0, len(l1) // 2):
		if l1[i] == l1[len(l1) // 2 + i]:
			continue
		else:
			flag = 1
			break
	if flag == 1:
		print(':(')
	else:
		flag = 0
		for c in s[len(s) - len(l1) // 2:]:
			if c == 'a':
				flag = 1
				break
		if flag == 0:
			print(s[:len(s) - len(l1) // 2])
		else:
			print(':(')
else:
	print(':(')


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
given = RW()
was = given[:(len(given) + given.count('a')) // 2]
added = was.replace('a', '')
print([':(', was][was + added == given])


def hate_a(t: str):
	t_without_a = remove_a(t)
	len_t = len(t_without_a)
	s_ = t_without_a[:len_t // 2]
	if len(t_without_a) % 2 != 0:
		return ':('
	elif t_without_a[:len_t // 2] != s_:
		return ':('
	else:
		s = t[:len(t) - len(s_)]
		return s if s + s_ == t else ':('

def remove_a(str_a: str):
	str_without_a = ''.join([s for s in str_a if s != 'a'])
	return str_without_a
t = input()
print(hate_a(t))


import sys
s = input()
n = len(s)
cnt = 0
for i in range(0, n):
	cnt += int(s[i] == 'a')
if (n + cnt) % 2 == 1:
	print(':(')
	sys.exit()
m = (n + cnt) // 2
s1 = ''
s2 = ''
for i in range(0, m):
	s1 = s1 + s[i]
for i in range(m, n):
	s2 = s2 + s[i]
s3 = ''
for i in range(0, m):
	if s1[i] != 'a':
		s3 = s3 + s1[i]
if s2 == s3:
	print(s1)
else:
	print(':(')


t = input()
removed = t.replace('a', '')
ds = removed[:int(len(removed) / 2)]
if removed[int(len(removed) / 2):] == ds:
	if t[len(t) - len(ds):] != ds:
		print(':(')
	else:
		print(t[:len(t) - len(ds)])
else:
	print(':(')


s = input()
n_x = 0
cur_s = ''
i = 0
while n_x != len(s) - i and i < len(s):
	if s[i] != 'a':
		n_x = n_x + 1
		cur_s = cur_s + s[i]
	i = i + 1
if cur_s == s[i:]:
	print(s[0:i])
else:
	print(':(')


t = input()
c = t.count('a')
if (len(t) - c) % 2 != 0:
	print(':(')
else:
	s = ''
	for i in range(c + (len(t) - c) // 2):
		if t[i] != 'a':
			s += t[i]
	if s == t[c + (len(t) - c) // 2:len(t)]:
		print(t[:c + (len(t) - c) // 2])
	else:
		print(':(')


T = input()
without_A = [x for x in T if x != 'a']
other_char_count = len(without_A) // 2
S_end = other_char_count + len(T) - len(without_A)
S = T[:S_end]
S_dash = T[S_end:]
S_without_a = ''.join([x for x in S if x != 'a'])
if S_without_a == S_dash:
	print(S)
else:
	print(':(')


t = input()[::-1]
h = t.replace('a', '')
l = len(h) // 2
print((':(', t[l:][::-1])[(h, t[:l]) == (h[:l] * 2, h[:l])])


NO_ANSWER_RESULT = ':('
string_t = input()
count_not_a = 0
for letter in string_t:
	if letter != 'a':
		count_not_a += 1
if count_not_a % 2 != 0:
	print(NO_ANSWER_RESULT)
else:
	exists = True
	for index in range(len(string_t) - count_not_a // 2, len(string_t)):
		if string_t[index] == 'a':
			exists = False
			break
	if not exists:
		print(NO_ANSWER_RESULT)
	else:
		index_s_sharp = len(string_t) - count_not_a // 2
		for index in range(len(string_t) - count_not_a // 2):
			if string_t[index] != 'a':
				if string_t[index] == string_t[index_s_sharp]:
					index_s_sharp += 1
				else:
					exists = False
					break
		if not exists:
			print(NO_ANSWER_RESULT)
		else:
			print(string_t[:len(string_t) - count_not_a // 2])


s = input()
n = len(s)
temp = ''
import sys
for i in range(n):
	if s[i] != 'a':
		temp += s[i]
	if temp == s[i + 1:]:
		print(s[:i + 1])
		sys.exit()
print(':(')


t = input()
n = len(t)
s = ''
num = l = 0
for i in range(n):
	if t[i] == 'a':
		num = len(s)
	else:
		s += t[i]
if len(s) % 2 == 1:
	print(':(')
	exit()
if num > len(s) // 2:
	print(':(')
	exit()
for i in range(0, len(s) // 2):
	if s[i] != s[i + len(s) // 2]:
		print(':(')
		exit()
for i in range(n):
	if t[i] != 'a':
		l += 1
	if l > len(s) // 2:
		exit()
	print(t[i], end='')


t = input()
rm_a = ''.join([w for w in t if w != 'a'])
l = len(rm_a)
m = l // 2
ok = True
if l % 2:
	ok = False
elif rm_a[:m] != rm_a[m:]:
	ok = False
elif t[-m:].count('a'):
	ok = False
if l == 0:
	print(t)
elif ok:
	print(t[:-m])
else:
	print(':(')


t = input()
x = ''
m = len(t)
for i in t:
	if i != 'a':
		x += i
l = len(x)
if l == 0:
	ans = t
else:
	ans = t[:-int(l / 2)]
test = ''
for i in ans:
	if i != 'a':
		test += i
if test != t[len(ans):]:
	print(':(')
else:
	print(ans)


s = input()
s1 = ''
a = 0
for i in s:
	if i != 'a':
		s1 += i
	else:
		a += 1
if len(s1) % 2 != 0:
	print(':(')
else:
	s1 = s1[:len(s1) // 2]
	N = len(s)
	n = len(s1)
	if s[N - n:] == s1:
		print(s[:N - n])
	else:
		print(':(')


import array
import math
import os
import random
import re
import sys
t = input()
n = int(len(t))
aa = 0
pp = 0
s = []
ss = []
rr = []
tt = int(n - 1)
i = 0
while i < n:
	aa = aa + 1
	if t[i] != 'a':
		if tt < i:
			break
		bb = str(t[i])
		s.append(bb)
		rr.append(t[i])
		i = i + 1
		if tt < i:
			break
		ss.append(t[tt])
		tt = tt - 1
	else:
		rr.append(t[i])
		i = i + 1
ss.reverse()
if s == ss:
	print(''.join([str(rr[i]) for i in range(0, len(rr))]))
	pp = 1
if pp == 0:
	print(':(')


from collections import Counter
from sys import exit
S = input()
SC = Counter(S)
D = dict()
ot = 0
for (a, b) in SC.items():
	if a == 'a':
		continue
	if b % 2:
		print(':(')
		exit()
	ot += b // 2
	D[a] = b // 2
OS = []
ORS = []
RS = []
for s in S:
	if s == 'a':
		if ot < 0:
			print(':(')
			exit()
		OS.append(s)
	elif ot > 0:
		ot -= 1
		OS.append(s)
		ORS.append(s)
	else:
		ot -= 1
		RS.append(s)
if ORS != RS:
	print(':(')
	exit()
print(''.join(OS))


from sys import stdin
s = stdin.readline().strip()
b = ''.join([c for c in s if c != 'a'])
if len(b) % 2 == 1:
	print(':(')
elif b[:len(b) // 2] != b[len(b) // 2:]:
	print(':(')
elif 'a' in s[len(s) - len(b) // 2:]:
	print(':(')
else:
	print(s[:len(s) - len(b) // 2])