CodeEff/ECCO huggingface dataset:
# Original solution
# 入力 : 自然数     ex) 12
# 出力 : 約数リスト ex) [2, 2, 3]
def factorization(n):
    R = int(n)
    s = 0
    L = []
    div = 2
    first = True
    while s == 0:
        for i in range(div, R + 1):
            if n % i == 0:
                n = n / i
                if i == div and not first:
                    alreadyExist = True
                else:
                    alreadyExist = False
                first = False
                div = i
                if n == 1:
                    s = 1
                if alreadyExist:
                    L[-1][1] += 1
                else:
                    L.append([i, 1])
                break
    return L


n = int(eval(input()))
t = [0 for i in range(n)]
fact = []
for i in range(n):
    # print(i)
    t[i] = int(eval(input()))
    if i == 0:
        fact = factorization(t[i])
    else:
        tmpFact = factorization(t[i])
        for _tmpFact in tmpFact:
            for _fact in fact:
                if _fact[0] == _tmpFact[0]:
                    _fact[1] = max(_fact[1], _tmpFact[1])
                    break
                elif _fact[0] == fact[-1][0]:
                    fact.append(_tmpFact)
# つまり全t[i]で割り切れる値を出せということ
# 最小公倍数を出せばよい
sum = 1
for _fact in fact:
    sum *= _fact[0]**_fact[1]
print(sum)

# Optimized solution
def gcd(a, b):
    while b > 0:
        tmp = a
        a = b
        b = tmp % b
    return a


def lcm(a, b):
    tmp = gcd(a, b)
    return (a//tmp) * b


n = int(eval(input()))
t = [0 for i in range(n)]
for i in range(n):
    t[i] = int(eval(input()))
t = sorted(t)
_sum = t[0]
for i in range(1, n):
    # print("sum:{} t:{} lcm:{}".format(sum, t, lcm(sum, t)))
    _sum = lcm(_sum, t[i])
    # print(sum)
print(_sum)
# Original solution

def lcmm(l,m):
    low,high = 1,1
    
    if(l==m):return l
    elif(l>m):
        if(l % m ==0):return l
        high = l
        low = m
        
    else:
        if(m % l ==0):return m
        high = m
        low = l
    lcm = high
    while(lcm%low != 0):
        lcm += high

    return lcm
n = int(input().strip())
last = 1
lcm = 1
for i in range(n):
    num = int(input().strip())
    lcm = lcmm(lcm,num)
    #print(lcm)

print(lcm)
    


# Optimized solution
def gcd(a,b):
    if(a == 0):
        return b
    else:
        return gcd(b % a, a)
    
def lcmm(l,m):

    prod = l * m

    gcD = gcd(l,m)

    return (prod // gcD)

n = int(input().strip())

lcm = 1
for i in range(n):
    num = int(input().strip())
    lcm = lcmm(lcm,num)
    #print(lcm)

print(lcm)
# Original solution
import math
from functools import reduce

def lcm_base(x, y):
  return (x*y)//math.gcd(x, y)

def lcm(*numbers):
  return reduce(lcm_base, numbers, 1)

def lcm_list(umbers):
  return reduce(lcm_base, numbers, 1)

n = int(eval(input()))
t = []
for i in range(n):
  t_ = int(eval(input()))
  t.append(t_)
  
print((lcm(*t)))

# Optimized solution
import math
n=int(eval(input()))
t=[int(eval(input())) for i in range(n)]
res=t[0]
for i in range(1,n):
  res=res*t[i]//math.gcd(res,t[i])
print(res)
# Original solution
N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]

pnmax = {}

def pn(A):
	a = A
	for n in range(2, A + 1):
		if a == 1:
			return
		c = 0
		while not a % n:
			c += 1
			a //= n
		if 0 < c:
			if not n in pnmax:
				pnmax[n] = c
			else:
				pnmax[n] = max(pnmax[n], c)

for t in T:
	pn(t)

r = 1
for k, v in list(pnmax.items()):
	r *= k ** v

#print(pnmax)
print(r)


# Optimized solution
N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]

def gcd(a, b):
	if not a % b:
		return b
	else:
		return gcd(b, a % b)

l = T[0]
for n in range(1, N):
	l = l * T[n] // gcd(l, T[n])

print(l)
# Original solution
N = int(eval(input()))
T = [int(eval(input())) for k in range(N)]
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)

# aとbの最小公倍数
# a*b = lcm(a,b)*gcd(a,b) より
def lcm(a,b):
    return a*b//gcd(a,b)
ans = 1
for e in T:
    ans = lcm(e,ans)
print(ans)


# Optimized solution
N = int(eval(input()))
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)
def lcm(a,b):
    return a*b//gcd(a,b)

T = [int(eval(input())) for _ in range(N)]
ans = T[0]
for e in T:
    ans = lcm(e,ans)
print(ans)
# Original solution
N = int(eval(input()))
T = []
for i in range(N):
    T.append(int(eval(input())))

m = max(T)
mm = m
while True:
    flg =False
    for j in range(N):
        if m % T[j] != 0:
            flg = True
            break
    if flg == True:
        m += mm
    else:
        print(m)
        exit()


# Optimized solution
def gcd(a,b):
    while b:
        a,b = b,a%b
    return a


def lcm(a,b):
    return (a*b) // gcd(a,b)


N = int(eval(input()))
T = []
for i in range(N):
    T.append(int(eval(input())))

t = T[0]
for i in range(N - 1):
    t = lcm(t,T[i+1])
print(t)
# Original solution
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]
a = T[0]
for i in range(1,N):
    b = T[i]
    c = gcd(a,b)
    a = a*(b//c)
print(a)

# Optimized solution
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]
ans = T[0]
for i in range(1,N):
    a = gcd(ans,T[i])
    ans = (ans//a)*T[i]
print(ans)
# Original solution
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]
ans = T[0]
for i in range(1,N):
    a = gcd(ans,T[i])
    ans = (ans//a)*T[i]
print(ans)

# Optimized solution
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]
a = T[0]
for i in range(1,N):
    b = T[i]
    c = gcd(a,b)
    a = (a//c)*b
print(a)
# Original solution
N = int(eval(input()))
T = [int(eval(input())) for i in range(N)]
T.sort()
T.reverse()
result = T[0]

for i in range(1, N):
    a = 1
    while True:
        if (result * a) % T[i] == 0:
            result *= a
            break
        a += 1

print(result)


# Optimized solution
N = int(eval(input()))
T = [int(eval(input())) for i in range(N)]
result = T[0]

for i in range(1, N):
    n = T[i]
    m = result
    while n % m != 0:
        m, n = n%m, m
    result = (result * T[i]) // m

print(result)
# Original solution
from functools import reduce

#def gcd(a, b):
#    while b:
#        a, b = b, a % b
#    return a

def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def lcm(a, b):
    return a * b // gcd(a,b)

N = int(eval(input()))
Ts = []
c = 1
for i in range(N):
    c = lcm(c, int(eval(input())))

print((int(c)))


# Optimized solution
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#def gcd(m, n):
#    r = m % n
#    return gcd(n, r) if r else n

def lcm(a, b):
    return a * b // gcd(a,b)

N = int(eval(input()))
Ts = []
c = 1
for i in range(N):
    c = lcm(c, int(eval(input())))

print((int(c)))
# Original solution
N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]

def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
      
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
  
print((lcm_list(T)))

# Optimized solution
N = int(eval(input()))
T = []
for i in range(N):
    T.append(int(eval(input())))
    
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
      
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
  
print((lcm_list(T)))
# Original solution
import sys
import fractions
sys.setrecursionlimit(200000000)

N = int(eval(input()))
NUMS = [int(eval(input())) for _ in range(N)]
NUMS = list(set(NUMS))

def gcd(num1, num2):
    if num2 == 0:
        return num1
    else:
        return gcd(num2, num1 % num2)


res = NUMS[0]
for num in NUMS[1:]:
    res = res * num // gcd(res, num)

print((int(res)))

# Optimized solution
import sys
sys.setrecursionlimit(200000000)

N = int(eval(input()))
NUMS = [int(eval(input())) for _ in range(N)]
NUMS = list(set(NUMS))

def gcd(num1, num2):
    if num2 == 0:
        return num1
    else:
        return gcd(num2, num1 % num2)


res = NUMS[0]
for num in NUMS[1:]:
    res = res * num // gcd(res, num)

print((int(res)))
# Original solution
n=int(eval(input()))

if n==1:
    print((eval(input())))
    quit()
    
def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)

def lcm(a,b):
    return a*b//gcd(a,b)

ans = int(eval(input()))
for i in range(n-1):
    tmp = int(eval(input()))
    ans = lcm(tmp,ans)
print(ans)


# Optimized solution
n=int(eval(input()))
'''
if n==1:
    print(input())
    quit()
 '''   
def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)

def lcm(a,b):
    return a*b//gcd(a,b)

ans = int(eval(input()))
for i in range(n-1):
    tmp = int(eval(input()))
    ans = lcm(tmp,ans)
print(ans)
# Original solution
#!/usr/bin/env python

from functools import reduce
import math

# GCD and LCM are not in math module.  They are in gmpy, but these are simple enough:

def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    while b > 0:
        a, b = b, a % b
    return a
    
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b // gcd(a, b)

N = int(eval(input()))
ts = []
for _ in range(N):
  T = int(eval(input()))
  ts.append(T)

# print(reduce(lcm, ts))
ans = 1
for i in range(N):
  ans = lcm(ans, ts[i])
print(ans)


# Optimized solution
#!/usr/bin/env python

from functools import reduce

# GCD and LCM are not in math module.  They are in gmpy, but these are simple enough:

def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    while b > 0:
        a, b = b, a % b
    return a
    
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b // gcd(a, b)

N = int(eval(input()))
ts = []
for _ in range(N):
  T = int(eval(input()))
  ts.append(T)

print((reduce(lcm, ts)))
# ans = 1
# for i in range(N):
#   ans = lcm(ans, ts[i])
# print(ans)
# Original solution
N = int(eval(input()))
Tn = [int(eval(input())) for i in range(N)]


def gcd(a, b):
    result = a
    k = 0
    n = b

    while True:
        k = result % n
        result = n
        n = k
        if k == 0:
            break

    return result


def gcd_n(numbers):
    l = numbers[0]

    for i in range(len(numbers)):
        l = gcd(l, numbers[i])

    return l


def lcm(a, b):
    g = gcd(a, b)

    return a * (b // g)


def lcm_n(numbers):
    l = numbers[0]

    for i in range(len(numbers)):
        l = lcm(l, numbers[i])

    return l


def main():
    print((lcm_n(Tn)))
    return


main()


# Optimized solution
N = int(eval(input()))


def gcd(a, b):
    result = a
    k = 0
    n = b

    while True:
        k = result % n
        result = n
        n = k
        if k == 0:
            break

    return result


def lcm(a, b):
    g = gcd(a, b)

    return a * (b // g)


def main():
    ans = 1

    for i in range(N):
        ans = lcm(ans, int(eval(input())))

    print(ans)
    return


main()
# Original solution
N = int(eval(input()))
T = [int(eval(input())) for i in range(N)]
T.sort()
while True:
    flag = False
    for i in range(N-1):
        if T[-1]%T[i]!=0:
            T[-1] += T[-1]
            flag = True
            break
    if flag == False:
        print((T[-1]))
        break


# Optimized solution
N = int(eval(input()))
T = [int(eval(input())) for i in range(N)]
ans = 1

def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

for i in range(N):
    ans = (ans*T[i])//gcd(ans,T[i])

print(ans)
# Original solution
n = int(eval(input()))
t = [int(eval(input())) for _ in range(n)]

f, ans, x = 0, 1, 2

while x<=max(t):
    for i in range(n):
        if t[i]%x==0:
            t[i] //= x
            f = 1
    if f:
        ans *= x
        f = 0
    else:
        x += 1
for i in t:
    ans *= i
print(ans)

# Optimized solution
n = int(eval(input()))
t = [int(eval(input())) for _ in range(n)]


#a>b
def gcd(a, b):
    if b:
        return gcd(b, a%b)
    else:
        return a

def lcm(a, b):
    if a>b:
        g = gcd(a, b)
        return a*b//g
    else:
        g = gcd(b, a)
        return a*b//g

ans = 1
for i in range(n):
    ans = lcm(ans, t[i])

print(ans)
# Original solution
def gcd(a, b):
    if b == 1:
        return 1
    # a > b　を仮定
    r = a % b
    if r == 0:
        return b
    else:
        return gcd(b, r)

#def lcm(A, n):
#    if n == 2:
#        return A[0]*A[1] // gcd(A[0], A[1])
#    #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
#    a = lcm(A, n-1)
#    return a* A[n-1] // gcd(a, A[n-1])

n = int(eval(input()))
#a = []
T1 = int(eval(input()))
for i in range(n-1):
    T2 = int(eval(input()))
    T1 = T1*T2 // gcd(T1, T2)
    #a.append(int(input()))
#a.sort(reverse = True)
#ans = lcm(a, n)
print((str(T1)))

# Optimized solution
import sys
sys.setrecursionlimit(10000)

def gcd(a, b):
    if b == 1:
        return 1
    r = a % b
    if r == 0:
        return b
    else:
        return gcd(b, r)

def lcm(A, n):
    if n == 2:
        return A[0]* (A[1] // gcd(A[0], A[1]))
    #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
    rec = lcm(A, n-1)
    return rec * (A[n-1] // gcd(rec, A[n-1]))

n = int(eval(input()))
a = []
for i in range(n):
    a.append(int(eval(input())))
if n >= 2:
    ans = lcm(a, n)
else:
    ans = a[0]
print((str(ans)))
# Original solution
import sys
N = int(eval(input()))
T = []
for i in range(N):
    T.append(int(eval(input())))
T = sorted(T, reverse=True)
for i in range(1, 10**18//T[0] + 1):
    f = True
    for n in T[1:]:
        if i*T[0] % n != 0:
            f = False
            break
    if f:
        print((i*T[0]))
        sys.exit()

# Optimized solution
def gcd(a, b):
    """最大公約数(Greatest Common divisor)を求める.

    ユークリッドの互除法の実装.
    ああああ

    Parameters
    ----------
    a : int
        自然数.
    b : int
        自然数.

    Returns
    -------
    int
        最大公約数
    """
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    """最小公約数(least common multiple)を求める.

    Parameters
    ----------
    a : int
        自然数.
    b : int
        自然数.

    Returns
    -------
    int
        最小公倍数
    """
    return a * b // gcd(a, b)

N = int(eval(input()))
T = []
for i in range(N):
    T.append(int(eval(input())))
ans = 1
for t in T:
    ans = lcm(ans, t)
print(ans)
# Original solution
n=int(eval(input()))
l=list(set([int(eval(input())) for d in range(n)]))  
a=l[0]
sd=0
for i in l[1:]:
  for h in range(min(i,a)+1)[:0:-1]:
    if (a%h,i%h)==(0,0):
      sd=h
      break
  a=a*i//sd
print(a)

# Optimized solution
n=int(eval(input()))
l=list(set([int(eval(input())) for d in range(n)]))  
a=l[0]
def gcd(a,s):
  a,s=min(a,s),max(a,s)
  if a==0:return s
  else:return gcd(s%a,a)

for i in l[1:]:
  a=a*i//gcd(a,i)
print(a)
# Original solution
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return eval(input())

# GCD -- START --
def gcd(x,y):
  while y:
    x,y=y,x%y
  return x
# GCD --- END ---

# LCM -- START --
def lcm(x,y):
  return x*y//gcd(x,y)
# LCM --- END ---

def main():
  n=I()
  ans=I()

  for _ in range(n-1):
    ans=lcm(ans,I())

  return ans

# main()
print((main()))


# Optimized solution
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return eval(input())

# GCD -- START --
def gcd(x,y):
  while y:
    x,y=y,x%y
  return x
# GCD --- END ---

# LCM -- START --
def lcm(x,y):
  return x*y//gcd(x,y)
# LCM --- END ---

def main():
  n=I()
  ans=1
  for _ in range(n):
    ans=lcm(ans,I())

  return ans

# main()
print((main()))
# Original solution
# code-festival-2017-qualcC - Inserting 'x'
from collections import deque


def main():
    S = deque(list(input().rstrip()))
    ans = 0
    while len(S) >= 2:
        l, r = S[0], S[-1]
        if l == r:
            S.popleft(), S.pop()
        else:
            ans += 1
            if l == "x":
                S.append("x")
            elif r == "x":
                S.appendleft("x")
            else:
                print((-1))
                return
    print(ans)


if __name__ == "__main__":
    main()

# Optimized solution
# code-festival-2017-qualcC - Inserting 'x'
def main():
    S = input().rstrip()
    ans, l, r = 0, 0, len(S) - 1
    while l < r:
        if S[l] == S[r]:
            l += 1
            r -= 1
        else:
            ans += 1
            if S[l] == "x":
                l += 1
            elif S[r] == "x":
                r -= 1
            else:
                print((-1))
                return
    print(ans)


if __name__ == "__main__":
    main()
# Original solution
# 2019-11-21 01:26:03(JST)
import sys
import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r, insort_left as in_l
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np 

def is_palindrome_in(s):
    s = s.replace('x', '')
    if list(s) == list(reversed(s)):
        return True
    return False

def main():
    s = sys.stdin.readline().rstrip()
    
    if not is_palindrome_in(s):
        print((-1))
        sys.exit()
    
    s = list(s)
    # deque で insertが使えるのがver3.5以降のようです(AtCoder はver3.4)
    # 初めdequeでやっててなぜRuntime Errorになるのか全くわからなかった
    # でもこれだとTLEになってしまうかもしれません

    count = 0
    i, j = 0, 0
    while i < len(s) - 1 - j:
        if s[i] == 'x':
            if s[-1-j] != 'x':
                s.insert(len(s)-j, 'x')
                count += 1
        elif s[-1-j] == 'x':
            s.insert(i, 'x')
            count += 1
        
        i += 1
        j += 1

    print(count)
    

if __name__ == "__main__":
    main()


# Optimized solution
# 2019-11-21 01:26:03(JST)
import sys
import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r, insort_left as in_l
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np 

def is_palindrome_in(s):
    s = s.replace('x', '')
    if list(s) == list(reversed(s)):
        return True
    return False

def main():
    s = sys.stdin.readline().rstrip()
    
    if not is_palindrome_in(s):
        print((-1))
        sys.exit()
    
    s = collections.deque(s)
    
    count = 0
    while len(s) > 1:
        if s[0] == 'x':
            if s[-1] == 'x':
                s.popleft(); s.pop()
            else:
                s.popleft()
                count += 1
        else:
            if s[-1] != 'x':
                s.popleft(); s.pop()
            else:
                s.pop()
                count += 1

    print(count)

if __name__ == "__main__":
    main()
# Original solution
import sys
S=list(input())

cnt=0
while len(S)>1:
	#print S,cnt
	if S[0]==S[-1]:
		S.pop(0)
		S.pop()
	elif S[0]!=S[-1] and S[0]=="x":
		cnt+=1
		S.append("x")
	elif S[0]!=S[-1] and S[-1]=="x":
		cnt+=1
		S.insert(0,"x")
	else:
		print("-1")
		sys.exit()
print(cnt)

# Optimized solution
import sys
S=input()

cnt=0
while len(S)>1:
	#print S,cnt
	if S[0]==S[-1]:
		S=S[1:-1]
	elif S[0]!=S[-1] and S[0]=="x":
		cnt+=1
		S=S+"x"
	elif S[0]!=S[-1] and S[-1]=="x":
		S="x"+S
		cnt+=1
	else:
		print("-1")
		sys.exit()
print(cnt)
# Original solution
import sys
stdin = sys.stdin

def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import deque

s = deque(lc())
lens = len(s)

ok = True
ans = 0

while len(s):
    if len(s) == 1:
        s.pop()
    
    elif s[0] == s[-1]:
        s.pop()
        s.popleft()
        
    else:
        if s[0] == "x":
            s.append("x")
            ans += 1
        elif s[-1] == "x":
            s.appendleft("x")
            ans += 1
        else:
            ok = False
            break
    
if ok:
    print(ans)
else:
    print((-1))

# Optimized solution
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x) - 1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


# 回文判定
def judge(s):
    news = ""
    for si in s:
        if si != 'x':
            news += si

    if news == news[::-1]:
        return True
    else:
        return False

# 操作の最小値
def min_insertion(s):
    news = ""
    for si in s:
        if si != 'x':
            news += si

    n = len(news)
    fir = [0] * ((n + 1)//2)
    lat = [0] * ((n + 1) // 2)

    # 前半
    cursor = 0
    for si in s:
        if si == 'x':
            fir[cursor] += 1
        else:
            cursor += 1

        if cursor == (n+1)//2:
            break

    # 後半
    cursor = 0
    for si in s[::-1]:
        if si == 'x':
            lat[cursor] += 1
        else:
            cursor += 1

        if cursor == (n + 1) // 2:
            break

    ans = 0
    for firi, lati in zip(fir, lat):
        ans += abs(firi - lati)

    return ans


# 入力
s = ns()

# x以外の回文判定
is_kaibun = judge(s)

# 回文でないならおわり
# 回文ならば最小値出す
if is_kaibun:
    if len(set(list(s))) == 1:
        print((0))
    else:
        print((min_insertion(s)))
else:
    print((-1))