def is_duicheng(n):
n_str = str(n)
return n_str[0] == n_str[3] and n_str[1] == n_str[2]
# if n_str[0] == n_str[3] and n_str[1] == n_str[2]: > 复杂处理
# return True
# else:
# return False
#读入10个整数
line = input().split()
nums = []
for s in line:
nums.append(int(s))
#print("nums=", nums)
duicheng_list = []
for n in nums:
if is_duicheng(n):
duicheng_list.append(n)
for d in duicheng_list:
print(d, end=' ')
print(len(duicheng_list))