Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.

Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last character of the word to the beginning of the word. He calls this a cyclic shift. He can apply cyclic shift many times. For example, consecutively applying cyclic shift operation to the word "abracadabra" Hongcow will get words "aabracadabr", "raabracadab" and so on.

Hongcow is now wondering how many distinct words he can generate by doing the cyclic shift arbitrarily many times. The initial string is also counted.


-----Input-----

The first line of input will be a single string s (1 ≤ |s| ≤ 50), the word Hongcow initially learns how to spell. The string s consists only of lowercase English letters ('a'–'z').


-----Output-----

Output a single integer equal to the number of distinct strings that Hongcow can obtain by applying the cyclic shift arbitrarily many times to the given string.


-----Examples-----
Input
abcd

Output
4

Input
bbb

Output
1

Input
yzyz

Output
2



-----Note-----

For the first sample, the strings Hongcow can generate are "abcd", "dabc", "cdab", and "bcda".

For the second sample, no matter how many times Hongcow does the cyclic shift, Hongcow can only generate "bbb".

For the third sample, the two strings Hongcow can generate are "yzyz" and "zyzy".

Difficulty: EASY
Tags: String algorithms

Implementation

Starter code:

Solutions:
n = input().strip()
l = []
ans = 0
for i in range(len(n)):
	if n[i:] + n[:i] not in l:
		l.append(n[i:] + n[:i])
		ans += 1
	else:
		break
print(ans)


import sys
s = input()

def foo(x):
	global s
	y = x[-1] + x[:len(x) - 1]
	if s == y:
		return 1
	return foo(y) + 1
print(foo(s))


s = input()
s1 = s
s2 = ''
cou = 0
while s2 != s1:
	s3 = s[0:len(s) - 1]
	s2 = s[-1] + s3
	cou += 1
	s = s2
print(cou)


s = input()
l = []
for i in range(len(s)):
	l.append(s[-1] + s[:len(s) - 1])
	s = l[-1]
print(len(set(l)))


s = input()
l = list(s)
a = set()
for _ in range(len(s)):
	a.add(s)
	lnew = l[1:] + [l[0]]
	s = ''.join(lnew)
	l = list(s)
print(len(a))


s = input()
f = set([s])
for i in range(len(s)):
	f.add(s[i:] + s[:i])
print(len(f))


def Main():
	s = input()
	st = set()
	for i in range(len(s)):
		ss = s[i:] + s[:i]
		st.add(ss)
	print(len(st))
Main()


string = input()
s = set()
for i in range(len(string)):
	if string not in s:
		s.add(string)
	string = string[len(string) - 1] + string[:-1]
print(len(s))


s = input()
k = s[-1] + s[:-1]
ans = 1
while s != k:
	k = k[-1] + k[:-1]
	ans += 1
print(ans)


a = input()
d = {a}
for i in range(len(a)):
	a = a[-1] + a[0:-1]
	d.add(a)
print(len(d))


s = input()
a = set()
newS = s
for i in range(len(s)):
	a.add(newS)
	newS = newS[-1] + newS[0:-1]
print(len(a))


s = input()
d = {}
ans = 1
d[s] = 1
for i in range(len(s)):
	s = s[-1] + s[0:-1]
	if s not in d:
		d[s] = 1
		ans += 1
print(ans)


def shift(s):
	new_s = ''
	new_s += s[-1]
	new_s += s[:-1]
	return new_s
s = input()
n = len(s)
res = set()
res.add(s)
for i in range(n):
	s = shift(s)
	res.add(s)
print(len(res))


s = input()
d = {s: 0}
for i in range(len(s)):
	s = s[-1] + s[:-1]
	d[s] = d.get(s, 0) + 1
print(len(d.keys()))


a = input()
n = [a]
for i in range(len(a)):
	a = a[-1] + a[0:len(a) - 1]
	if a not in n:
		n.append(a)
	else:
		break
print(len(n))


import sys
import math
st = str(input())
mp = {}
for i in range(len(st) + 2):
	st = st[1:] + st[0]
	mp[st] = 1
print(len(mp))


x = list(input())
y = len(x)
c = 0
k = list()
for i in range(y):
	g = ''.join(x)
	if g in k:
		pass
	else:
		c += 1
		k.append(g)
	f = x[y - 1]
	x.pop(y - 1)
	x.insert(0, f)
print(c)


a = input()
n = len(a)
lis = []
lis.append(a)
for i in range(1, n):
	newstr = a[i:n] + a[:i]
	lis.append(newstr)
set_lis = set(lis)
print(len(set_lis))


s = input()
b = set()
for i in range(len(s)):
	s = s[-1] + s[:len(s) - 1]
	b.add(s)
print(len(b))


def Cycle(s):
	return s[-1] + s[:len(s) - 1]
s = input()
a = [s]
while Cycle(s) not in a:
	a.append(Cycle(s))
	s = Cycle(s)
print(len(a))


s = input()
ss = {s}
l = len(s)
for i in range(l - 1):
	s = s[l - 1] + s[:l - 1]
	ss.add(s)
print(len(ss))


n = input()
b = n[-1] + n[:len(n) - 1]
a = 0
while b != n:
	b = b[-1] + b[:len(b) - 1]
	a += 1
print(a + 1)


x = str(input())
clone = x
len_ = len(x)
count = 0
for i in range(len_):
	first = clone[-1]
	second = clone[0:len_ - 1]
	clone = first + second
	if clone != x:
		count = count + 1
	else:
		count = count + 1
		break
print(count)


R = lambda : map(int, input().split())
val = input()
ans = set()
for i in range(len(val)):
	s = val[i:] + val[:i]
	if s not in ans:
		ans.add(s)
print(len(ans))


l = list(input())
x = []
d = []
a = len(l)
for i in range(1, int(a ** (1 / 2)) + 1):
	if not a % i:
		d.append(i)
		d.append(a // i)
d = list(set(d))
d.sort()
for i in d:
	if l == l[:i] * (a // i):
		print(i)
		exit()


s = input()
cnt = 1
l = len(s)
p = 1
d = []
d.append(s)
while p < l:
	n = s[-1] + s[:l - 1]
	if n not in d:
		d.append(n)
	s = n
	p += 1
print(len(d))


s = input()
k = set()
for i in range(len(s)):
	s = s[-1] + s[:-1]
	k.add(s)
print(len(k))


string = input()
a = set()
for i in range(len(string)):
	a.add(string[i:] + string[:i])
print(len(a))


str = input()
st = set()
l = len(str)
for i in range(l):
	if str not in st:
		st.add(str)
	str = str[l - 1] + str[0:l - 1]
print(len(st))


a = input()
n = len(a)
l = []
l.append(a)
while n > 0:
	s = ''
	s = s + a[n - 1] + a[:-1]
	if s not in l:
		l.append(s)
	else:
		break
	a = s
n1 = len(l)
print(n1)


s = input().strip()
st = set()
for i in range(51):
	st.add(s)
	s = s[-1] + s[:-1]
print(len(st))


(a, b) = (input(), [])
for i in range(len(a)):
	if a not in b:
		b.append(a)
	a = a[1:] + a[0]
print(len(b))


s = input()
c = {s}

def cyc(s2):
	return s2[-1] + s2[:-1]
for i in range(len(s)):
	s = cyc(s)
	c.add(s)
print(len(c))


from collections import defaultdict
s = input()
n = len(s)
d = defaultdict(int)
if n == 0:
	print('0')
else:
	for i in range(n):
		d[s] += 1
		s = s[-1] + s[:n - 1]
	print(len(d.keys()))


a = list(input())
b = []
n = len(a)
for k in range(n):
	t = a[0]
	a.remove(a[0])
	a.append(t)
	b.append(''.join(a))
print(len(set(b)))


stroka = input()
A = set()
for i in range(len(stroka)):
	A.add(stroka)
	stroka = stroka[-1] + stroka[:len(stroka) - 1]
print(len(A))


s = input()
ss = []
for i in range(len(s)):
	ss.append(s[i:] + s[:i])
ss.sort()
s = ss[0]
res = 1
for item in ss:
	if item != s:
		res += 1
		s = item
print(res)


word = input()
n = len(word)
x = 1
l = []
l.append(word)
for i in range(n):
	word = word[n - 1] + word[:-1]
	if word not in l:
		l.append(word)
		x = x + 1
print(x)


s = input()
myset = set()
myset.add(s)
for _ in range(len(s)):
	s = s[1:] + s[0]
	myset.add(s)
print(len(myset))


word = input()
line = []
for i in range(len(word)):
	if word not in line:
		line = line + [word]
	word = word[-1] + word[:-1]
print(len(line))


s = input()
tool = len(s) - 1
tmp = {s: 1}
ans = 1
for i in range(tool, 0, -1):
	s = s[tool] + s[:tool]
	if tmp.get(s, -1) == -1:
		tmp[s] = 1
		ans += 1
print(ans)


x = list(input())
y = []
y = x
j = 0
a = []
while x != a:
	a = []
	a.append(y[len(y) - 1])
	i = 0
	while i < len(y) - 1:
		a.append(y[i])
		i = i + 1
	y = a
	j = j + 1
print(j)


s = str(input())
res = set()
res.add(s)
for i in range(len(s)):
	curr = s[i:] + s[:i]
	res.add(curr)
print(len(res))


s = input()
s1 = s

def transform(s):
	return s[-1] + s[:len(s) - 1]
s = transform(s)
count = 1
while s != s1:
	s = transform(s)
	count += 1
print(count)


s = input()
L = []
for i in range(len(s)):
	s = s[-1] + s[:-1]
	if s not in L:
		L.append(s)
print(len(L))


keke = dict()
ans = 0
s = input().strip()
for i in range(0, len(s)):
	if not s in keke:
		keke[s] = 1
		ans += 1
	s = s[-1] + s[:-1]
print(ans)


q = input()
a = [q]
l = len(q)
q = q * 2
for i in range(1, l):
	a.append(q[i:i + l])
print(len(set(a)))


n = input()
a = [n]
for i in range(len(n) - 1):
	n = n[-1] + n[:len(n) - 1]
	if n not in a:
		a.append(n)
print(len(a))


b = list(input())
l = []
for _ in range(len(b)):
	b.insert(0, b[-1])
	b.pop()
	l.append(''.join(b))
print(len(set(l)))


def main():
	s = input()
	print(len({''.join((s[i] for i in range(j, j + len(s)))) for j in range(1 - len(s), 1)}))
main()


s = input()
a = [s[i:] + s[:i] for i in range(len(s))]
print(len(set(a)))


word = input('')
wordlist = [word]
cnt = 0
for char in word:
	nw = word[-1] + word[:-1]
	if nw not in wordlist:
		wordlist.append(nw)
	word = nw
print(len(wordlist))


a = input()
b = ''
c = 0
d = a
while b != d:
	c += 1
	b = a[1:] + a[:1]
	a = b
print(c)


s = input()
ans = set()
for l in range(len(s)):
	t = s[l:] + s[:l]
	ans.add(t)
print(len(ans))


s = input()
y = len(s)
a = []
for i in range(len(s)):
	a.append(s[i:] + s[:i])
b = []
ans = 0
for i in a:
	if i not in b:
		b.append(i)
		ans += 1
print(ans)


def rotate(l, n):
	return ' '.join(l[n:] + l[:n])
word = list(input())
set_of_words = set()
for i in range(len(word)):
	set_of_words.add(rotate(word, i))
print(len(set_of_words))


s = input()
res = set()
for i in range(100):
	res.add(s)
	s = s[-1] + s[:-1]
print(len(res))


x = input().strip()
a = set()
l = len(x) - 1
for i in range(len(x)):
	x = x[l] + x[:l]
	a.add(x)
print(len(a))


S = input()
s = set()
s.add(S)
for i in range(len(S)):
	tmp = S[i:] + S[:i]
	s.add(tmp)
print(len(s))


s = input()
s1 = set()
for i in range(len(s)):
	s1.add(s[i:] + s[:i])
print(len(s1))


x = input()
y = x
i = 0
a = []
a.append(y)
while i < len(x):
	y = y[len(x) - 1] + y[0:len(x) - 1]
	a.append(y)
	i += 1
print(len(set(a)))


s = input()
n = len(s)
word_set = set()
word_set.add(s)
for i in range(n - 1):
	s = s[-1] + s[:n - 1]
	word_set.add(s)
print(len(word_set))


s = input()
i = 1
d = {}
d[s] = 1
while i <= len(s) + 1:
	s = s[len(s) - 1] + s[:-1]
	d[s] = 1
	i += 1
print(len(d))


s = input()
a = s[::-1]
for i in range(len(s)):
	if a[i] == s[0]:
		d = a[:i + 1][::-1] + a[i + 1:][::-1]
		if d == s:
			print(i + 1)
			break


s = input()
n = len(s)
res = set()
for i in range(n):
	res.add(s[i:] + s[:i])
print(len(res))


s = input()
used = set()
n = len(s)
for i in range(n):
	gg = s[i:] + s[:i]
	used.add(gg)
print(len(used))


s = input()
ans = set()
n = len(s)
for i in range(n):
	ch = s[len(s) - 1]
	s = s[:len(s) - 1]
	s = ch + s
	ans.add(s)
print(len(ans))


l = list(input())
s = ''.join(l)
d = []
d.append(s)
for i in range(len(l)):
	l.append(l[0])
	l.pop(0)
	s = ''.join(l)
	if s not in d:
		d.append(s)
print(len(d))


s = input()
for i in range(1, len(s) // 2 + 1):
	if s.count(s[:i]) * i == len(s):
		print(i)
		break
else:
	print(len(s))


s = input()
a = set()
n = len(s)
s += s
for i in range(n):
	a.add(s[i:n + i])
print(len(a))


def cy(n):
	z = n[-1]
	x = ''
	x += z
	x += n[0:-1]
	return x
n = input()
a = []
a.append(n)
for i in range(len(n)):
	n = cy(n)
	if n not in a:
		a.append(n)
print(len(a))


t = input()
u = [t]
p = 1
for k in range(len(t)):
	s = t[len(t) - 1] + t[:len(t) - 1]
	if s not in u:
		p += 1
		u.append(s)
		t = s
	else:
		pass
print(p)


linea = input()
lin = list(linea)
c = 0
rep = []
for l in lin:
	faux = True
	ult = lin[len(lin) - 1]
	ini = lin[0]
	lin.insert(0, ult)
	lin.pop(len(lin) - 1)
	s = ''.join(lin)
	for el in rep:
		if s == el:
			faux = False
	if faux:
		if s != linea:
			c = c + 1
	rep.append(s)
print(c + 1)


s = input()
print(len({s[-i:] + s[:-i] for i in range(50)}))


s = input()
c = set()
for i in range(len(s)):
	s = s[1:] + s[0]
	c.add(s)
print(len(c))


s = input()
s_s = set()
c = 0
while c != len(s):
	s_s.add(s[len(s) - c:] + s[:len(s) - c])
	c += 1
print(len(s_s))


s = input()
o = set()
for i in range(len(s)):
	o.add(s)
	s = s[-1] + s[:-1]
print(len(o))


s = input()
strings = []
strings.append(s)
i = 0
while i < len(s):
	s = s[1:] + s[0]
	if s not in strings:
		strings.append(s)
	i = i + 1
print(len(strings))


s = input()
l = len(s)
s = s * 2
ss = set()
for i in range(l):
	ss.add(s[i:i + l])
print(len(ss))


t = input()
l = len(t)
f = 0
for i in range(1, l // 2 + 1):
	if l % i == 0:
		c = l // i
		if t == c * t[:l // c]:
			print(i)
			f = 1
			break
if f == 0:
	print(l)


s = input()
answers = set()
for i in range(len(s) + 1):
	answers.add(s)
	s = s[-1] + s[:len(s) - 1]
print(len(answers))


def shift(s):
	letters = list(s)
	return letters[len(s) - 1] + ''.join(letters[0:len(s) - 1])
s = input()
d = set()
while s not in d:
	d.add(s)
	s = shift(s)
print(len(d))


x = input()
s = set()
for _ in range(len(x)):
	s.add(x)
	x = x[-1] + x[:-1]
print(len(s))


a = input()
b = set()
for i in range(len(a)):
	s = a[i:] + a[:i]
	b.add(s)
print(len(b))


from copy import copy
s = input()
used = []
used.append(s)
p = 1
for i in range(len(s)):
	s = s[len(s) - 1] + s[:-1]
	if s not in used:
		p += 1
		used.append(s)
print(p)


s = input()
i = 0
t = [s]
j = 1
p = len(s)
for i in range(p):
	s = s[p - 1] + s[0:p - 1:1]
	if s not in t:
		t.append(s)
		j += 1
print(j)


a = input()
a = a.strip()
razlicni = set()
razlicni.add(a)
for _ in range(len(a)):
	a = a[-1] + a[:-1]
	razlicni.add(a)
print(len(razlicni))


def shift(seq, n=2):
	a = n % len(seq)
	return seq[-a:] + seq[:-a]
s = [i for i in input()][:]
c = 0
carr = []
for i in range(len(s)):
	carr.append(shift(s, i))
res = []
for i in carr:
	if i not in res:
		res.append(i)
print(len(res))


a = input()
a = list(a)

def move(a):
	k = a[0]
	for i in range(len(a) - 1):
		a[i] = a[i + 1]
	a[-1] = k
	return a
res = 1
s = set()
s.add(''.join(a))
for i in range(len(a) + 1):
	a = move(a)
	if ''.join(a) not in s:
		res += 1
		s.add(''.join(a))
print(res)


s = input()
ansset = []
for i in range(len(s)):
	l = s[:len(s) - 1]
	r = s[len(s) - 1]
	s = r + l
	ansset.append(s)
ans = set(ansset)
print(len(ans))


st = input()
arr = []
for i in range(len(st)):
	arr.append(st[i:] + st[:i])
arr = sorted(arr)
cnt = 1
for i in range(1, len(st)):
	if arr[i] != arr[i - 1]:
		cnt = cnt + 1
print(cnt)


l = list(input())
s = set()
for i in range(len(l)):
	t = l[i:][:]
	for x in l[:i]:
		t += [x]
	s |= {tuple(t)}
print(len(s))


s = input()
l = len(s)
for x in range(1, 1 + l // 2):
	step = l // x
	if s == s[:x] * step:
		print(x)
		break
else:
	print(l)


k = list(input())
l = []
z = 0
for i in k:
	l.append(i)
i = 1
while i <= 50:
	r = k.pop()
	k = [r] + k
	z = z + 1
	if l == k:
		break
	i = i + 1
print(z)


def different_words(s):
	return (lambda t: len(set((s[i:] + s[:i] for i in range(len(s))))))(s)
print(different_words(input()))


s = input()
a = list()
a.append(s)
b = list(s)
x = 1
for i in range(100):
	b.insert(0, b.pop())
	s = ''.join(b)
	if s not in a:
		a.append(s)
		x += 1
print(x)


s = input()
se = set()
for i in range(len(s)):
	se.add(s[i:] + s[:i])
print(len(se))


S = input()
s = set([])
N = len(S)
for i in range(N):
	new_S = S[i:] + S[:i]
	s.add(new_S)
print(len(s))


s = input()
z = set()
for i in range(len(s)):
	s = s[1:] + s[:1]
	z.add(s)
print(len(z))


I = lambda : list(map(int, input().split()))
s = input()
for i in range(1, len(s)):
	if s[:i] * (len(s) // i) == s:
		print(i)
		quit()
print(len(s))


S = input()
Slen = len(S)
W = {S}
Wnew = S
Wlen = 1
for i in range(Slen - 1):
	Wnew = Wnew[-1] + Wnew[:-1]
	if Wnew in W:
		continue
	W.add(Wnew)
	Wlen += 1
print(Wlen)


s1 = input()
s2 = s1
count = 1
for i in range(len(s1) - 1):
	s2 = s2[-1] + s2[:-1]
	if s2 != s1:
		count += 1
	else:
		break
print(count)


word = input('')
list = [word]
n = len(word) - 1
for i in range(len(word)):
	word = word[n] + word[0:n]
	if word not in list:
		list.append(word)
print(len(list))


spell = input()
s = set()
for i in range(len(spell)):
	s.add(spell[i:] + spell[:i])
print(len(s))


s = input()
a = []
for i in range(len(s)):
	s = s[-1] + s[:-1]
	a.append(s)
a = set(a)
print(len(a))


s = input()
was = [s]
prev = s
for i in range(len(s)):
	now = prev[-1] + prev[0:len(s) - 1]
	if now in was:
		break
	prev = now
	was.append(now)
print(len(was))


a = input()
c = 1
z = a[-1] + a[:len(a) - 1]
while z != a:
	z = z[-1] + z[:len(z) - 1]
	c += 1
print(c)


s = input()
d = {}
n = len(s)
for i in range(n):
	d[s] = 1
	s = s[-1] + s[:n - 1]
print(len(d))


s = input('')
t = list(s)
l = len(t)
cnt = 0
st = []
for i in range(l):
	tmp = t[l - 1]
	t.insert(0, tmp)
	del t[l]
	st1 = ''.join(t)
	if st1 in st:
		pass
	else:
		cnt = cnt + 1
	st.append(st1)
print(cnt)


s = input()
l = []
for i in s:
	l.append(i)
t = set()
for i in range(len(s)):
	f = ''
	for j in l:
		f += j
	t.add(f)
	c = l.pop(0)
	l.append(c)
print(len(t))


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 1000000007
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
s = input()
ans = set()
for x in range(len(s) + 2):
	ans.add(s)
	s = s[-1] + s[:-1]
print(len(ans))


s = input()
arr = []
for i in range(len(s)):
	s = s[1:] + s[0]
	arr.append(s)
print(len(set(arr)))


s = input()
ans = {s}
for i in range(len(s) + 3):
	s = s[1:] + s[0]
	ans.add(s)
print(len(ans))


s = input()
t = s[:len(s) - 1]
se = set()
for i in range(len(s) - 1, 0, -1):
	st = s[i] + t
	if st not in se:
		se.add(st)
	t = st[:len(st) - 1]
if s not in se:
	print(len(se) + 1)
else:
	print(len(se))


def main():
	try:
		while True:
			s = input()
			a = set()
			for i in range(len(s)):
				a.add(s)
				s = s[1:] + s[0]
			print(len(a))
	except EOFError:
		pass
main()


s = str(input())
l = set()
for i in range(0, len(s)):
	e = s[-1] + s[0:len(s) - 1]
	s = e
	l.add(e)
print(len(l))


string = input()
s = set()
for _ in range(len(string)):
	string = string[-1] + string[:-1]
	s.add(string)
print(len(s))


word = list(input())
x = []
str1 = ''.join(word)
x.append(str(str1))
count = 1
for i in range(len(word) - 1):
	word.insert(0, word[-1])
	del word[-1]
	str1 = ''.join(word)
	if str1 not in x:
		count += 1
		x.append(str1)
print(count)


word = list(input())
index = 0
m = []
k = []
num = 0
while index < len(word):
	m = m + [word.pop(-1)]
	word = m + word
	new = ''.join(word)
	if new not in k:
		num += 1
		k = k + [new]
	m = []
	index += 1
print(num)


s = input()
r = 1
t = [s]
for i in range(len(s)):
	res = s[1:] + s[0]
	if res not in t:
		t.append(res)
	s = res
print(len(t))


words = dict()

def shift(s):
	n = s[-1]
	for i in range(len(s) - 1):
		n += s[i]
	return n

def addAll(s):
	for i in range(len(s)):
		if s in words:
			words[s] += 1
		else:
			words[s] = 0
		s = shift(s)
addAll(input())
ma = 0
print(len(words))


s = input('')
l = []
l.append(s)
ctr = 1
n = len(s)
a = s[n - 1] + s[:n - 1]
for i in range(n):
	a = a[n - 1] + a[:n - 1]
	if a not in l:
		ctr = ctr + 1
	l.append(a)
print(ctr)


s = input()
snew = s + '#'
list = []
for i in range(len(snew)):
	if snew[i:-1] + snew[0:i] not in list:
		list.append(snew[i:-1] + snew[0:i])
print(len(list))


s = input()
k = 0
j = ''
i = 1
while s != j:
	if i == 1:
		j = s
		i = 0
	j = j[-1] + j[:-1]
	k += 1
print(k)


a = input()
done = [a]
n = len(a)
a = list(a)
for i in range(n - 1):
	a = [a[-1]] + a[:-1]
	x = ''.join(a)
	if x not in done:
		done.append(x)
print(len(done))


word = list(input())
comb = []
for i in range(len(word)):
	l = word[-1]
	del word[-1]
	word = [l] + word
	str1 = ''.join(word)
	comb.append(str1)
print(len(set(comb)))


x = input()
time = 1
x = list(x)
j = str(x)
v = x[len(x) - 1]
while True:
	v = x[len(x) - 1]
	q = 1
	z = 2
	while z <= len(x):
		x[len(x) - q] = x[len(x) - z]
		q += 1
		z += 1
	x[0] = v
	if str(x) == j:
		break
	else:
		time += 1
print(time)


s = input()
t = [s]
k = len(s) - 1
for i in range(k):
	s = s[k] + s[0:k]
	t.append(s)
t = list(set(t))
print(len(t))


def res(a):
	b = a[-1]
	a = a[:-1]
	a = b + a
	return a
a = str(input())
ans = 1
b = []
b.append(a)
for i in range(len(a) - 1):
	a = res(a)
	if a not in b:
		ans += 1
		b.append(a)
print(ans)


s = input()
ln = len(s)
S = s * 2
print(len(set((S[i:i + ln] for i in range(ln)))))


n = list(input())
tam = len(n)
con = 1
w = n[:tam]
y = n[:len(n)]
pas = True
i = 0
while i < tam and pas == True:
	y.insert(0, w.pop())
	y.pop()
	if y == n:
		pas = False
		i = tam
	else:
		con = con + 1
	i = i + 1
print(con)


s = set()
l = str(input())
for j in range(len(l) + 10):
	l = l[len(l) - 1] + l[0:len(l) - 1]
	s.add(l)
print(len(s))


s = input()
res = set()
for i in range(len(s) + 5):
	s = s[1:] + s[0]
	res.add(s)
print(len(list(res)))


def main():
	s = input()
	length = len(s)
	s += s
	was = set()
	for i in range(length):
		was.add(s[i:length + i])
	print(len(was))
main()


def test(s):
	t = [s]
	for i in range(len(s) - 1):
		s = s[len(s) - 1] + s[:len(s) - 1]
		if str(s) not in t:
			t.append(s)
	print(len(t))
s = input()
test(s)


string = input()
Set = set()
for i in range(0, string.__len__()):
	Set.add(string)
	string = string[-1] + string[:-1]
print(Set.__len__())


from collections import deque
val = deque(input())
length = len(val)
all = set()
while length:
	length -= 1
	all.add(''.join(val))
	val.appendleft(val.pop())
print(len(all))


def shift(n):
	a = []
	c = ''
	for i in range(len(n)):
		a += n[i]
	b = a[-1]
	for i in range(len(a) - 1):
		b += a[i]
	for i in range(len(b)):
		c += b[i]
	return c
word = input()
a = [word]
for i in range(len(word)):
	word = shift(word)
	if word in a:
		continue
	else:
		a += [word]
print(len(a))


s = input()
ans = []
for i in range(len(s)):
	ans.append(s[-i:] + s[:-i])
print(len(set(ans)))


from collections import defaultdict
import sys, os, math
s = input()
st = {s}
for i in range(len(s)):
	st.add(s[i:] + s[:i])
print(len(st))


def main():
	s = input()
	q = set()
	q.add(s)
	for i in range(len(s)):
		s = s[1:] + s[0]
		q.add(s)
	print(len(q))
main()


from collections import *
A = deque(list(input()))
S = set()
for i in range(len(A) + 1):
	S.add(''.join(A))
	A.appendleft(A.pop())
print(len(S))


s = input()
res = set()
for i in range(len(s)):
	l = i + len(s)
	sc = s[i:l] + s[0:i]
	res.add(sc)
print(len(res))


w = input()
s = set()
for shift in range(len(w)):
	s.add(w[-shift:] + w[:-shift])
print(len(s))


import re
word = input()
if len(word) >= 1 and len(word) <= 50 and re.match('[a-z]+', word):
	result = []
	for ind in range(0, len(word)):
		word = word[-1] + word[0:-1]
		result.append(word)
	print(len(set(result)))


s = input()
n = len(s)
s += s
dl = len(s)
d = set()
ans = 0
for i in range(dl - n):
	str = s[i:i + n]
	if not str in d:
		ans += 1
		d.add(str)
print(ans)


def extend_word(word):
	aux = word
	word_len = len(word)
	new_word = ''
	words = set()
	while True:
		for i in range(1, word_len):
			new_word = new_word + aux[i]
		new_word = new_word + aux[0]
		if new_word == word:
			break
		aux = new_word
		words.add(new_word)
		new_word = ''
	print(len(words) + 1)
word = input('')
extend_word(word)


s = input()
arr = set()
for i in range(len(s)):
	arr.add(s[i:] + s[:i])
print(len(arr))


string = input()
cycle = {string: 1}
comp = string
for x in range(len(string)):
	comp = comp[1:] + comp[0]
	if comp not in cycle:
		cycle[comp] = 1
print(len(cycle))


import sys
stri = input()
str_temp = ''
l = []
l.append(stri)
for i in range(1, len(stri)):
	str_temp = ''
	str_temp += stri[i]
	counter = i + 1
	c2 = 1
	while c2 < len(stri):
		str_temp += stri[counter % len(stri)]
		counter += 1
		c2 += 1
	if str_temp not in l:
		l.append(str_temp)
print(len(l))


def main():
	dict = {}
	s = input()
	f = len(s)
	s = s * f
	for i in range(f):
		dict[s[i:i + f]] = 1
	print(len(dict))
main()


s = input()
A = []
for i in range(len(s)):
	A.append(s)
	s = s[-1] + s[:-1]
q = set(A)
q = list(q)
print(len(q))


x = input()
lst = []
for i in range(len(x)):
	if x[i:] + x[:i] not in lst:
		lst.append(x[i:] + x[:i])
print(len(lst))


s = input()
count = 0
s1 = set()
while s not in s1:
	count += 1
	s1.add(s)
	s = s[-1] + s[:-1]
print(count)


s = input()
b = sorted(s)
l = []
counter = 1
i = 1
if b[0] == b[len(b) - 1]:
	print(1)
	exit()
else:
	a = s[1:len(s)] + s[0]
	while a != s:
		a = a[1:len(a)] + a[0]
		counter += 1
print(counter)


count = {}
str = input()
count[str] = 1
l = len(str)
for i in range(l):
	str = str[-1] + str[0:l - 1]
	count[str] = count.get(str, 0)
print(len(count))


s = input()
d = {s: 1}
for _ in range(len(s) - 1):
	s = s[-1:] + s[:-1]
	d.setdefault(s, 1)
print(len(d))


s = input()
test = s
count = 1
for i in range(len(s)):
	test = test[1:] + test[0]
	if test == s:
		break
	else:
		count += 1
print(count)


_ = input()
__ = len(_)
___ = _
____ = 0
while True:
	__ -= 1
	_____ = _[__:len(_)] + _[0:__]
	if _____ == _:
		print(____ + 1)
		exit()
	____ += 1


s = input()
ans = lambda a: len({a[i:] + a[:i] for i in range(len(a))})
print(ans(s))


s = input()
ans = 1
i = len(s) - 1
a = [s]
while i > 0:
	t = s[i:] + s[:i]
	if s[i:] + s[:i] not in a:
		ans += 1
		a.append(t)
	i -= 1
print(ans)


w = input()

def rota(a, b):
	lef = a[:b]
	rig = a[b:]
	return rig + lef
wList = []
wC = []
for i in range(len(w)):
	wList.append(w[i])
for i in range(len(w)):
	res = rota(wList, len(w) - 1)
	wC.append(''.join(res))
	wList = res
swC = set(wC)
print(len(swC))


n = input()
ans = 1
chk = n
for i in range(len(n)):
	chk = chk[-1] + chk[:-1]
	if chk != n:
		ans += 1
	else:
		break
print(ans)


word = str(input())
n = len(word)
alist = []
for i in range(n):
	new = word[::-1][0:i][::-1] + word[0:n - i]
	if not new in alist:
		alist.append(new)
print(len(alist))


s = input()
n = len(s)
a = []
for i in range(n - 1):
	k = s[i + 1:] + s[:i + 1]
	if k == s:
		break
	else:
		a.append(k)
print(len(a) + 1)


s = input()
st = set()
l = len(s)
for i in range(l):
	st.add(s[l - i:] + s[:l - i])
print(len(st))


n = input()
l = []
for i in range(len(n)):
	l.append(n[i:] + n[:i])
print(len(list(dict.fromkeys(l))))


from collections import deque
arr = deque(input())
res = set()
res.add(arr.__str__())
for i in range(len(arr)):
	arr.rotate(1)
	res.add(arr.__str__())
print(len(res))


s = input()
d = s + s
l = len(s)
c = set()
for i in range(l):
	aux = d[i:i + l]
	if aux not in c:
		c.add(aux)
print(len(c))


def rot(s):
	return s[1:] + s[:1]
s = input()
a = [s]
ans = 1
for i in range(len(s) - 1):
	s = rot(s)
	if not s in a:
		ans += 1
		a.append(s)
print(ans)


s = input()
n = len(s)
t = {}
t[s] = True
for i in range(n):
	s = s[1:] + s[0]
	t[s] = True
print(len(t))


string = input()
words = []
count = 0
for i in range(len(string)):
	if string not in words:
		count += 1
	words.append(string)
	string = string[1:] + string[0]
print(count)


s = input()
l = len(s)
z = []
z.append(s)
k = 1
for i in range(l - 1):
	s = s[-1] + s[:l - 1]
	if s not in z:
		z.append(s)
		k += 1
print(k)


def main():
	strin = input()
	new = strin
	lis = [strin]
	for i in range(0, len(strin) - 1):
		last = new[len(strin) - 1]
		new = last + new
		new = new[0:len(new) - 1]
		lis.append(new)
	set_s = set(lis)
	print(len(set_s))
main()


s = input()
table = [s]
for x in range(len(s) + 10):
	s1 = list(s)
	temp = s1[0]
	s1.append(s1[0])
	s1.remove(s1[0])
	s = ''.join(s1)
	if s not in table:
		table.append(s)
	else:
		break
print(len(table))


s = input()
n = len(s)
i = 0
a = []
while i < 50:
	s = s[-1] + s[:n - 1]
	if s not in a:
		a.append(s)
	i += 1
print(len(a))


s = input()
l = [s]
for _ in range(len(s) - 1):
	s = s[1:] + s[0]
	if s not in l:
		l.append(s)
print(len(l))


s = input()
l = set()
for i in range(len(s)):
	l.add(s)
	s = s[-1] + s[:-1]
print(len(l))


s = input()
p = set()
for i in range(100):
	if s not in p:
		p.add(s)
	s = s[-1] + s[:len(s) - 1]
print(len(p))


import math, sys, re, itertools, pprint, collections, copy
(rs, ri, rai, raf) = (input, lambda : int(input()), lambda : list(map(int, input().split())), lambda : list(map(float, input().split())))
t = input()
res = {t}
for i in range(52):
	t = t[-1] + t[:-1]
	res.add(t)
print(len(res))


w = input()
differen = []
differen.append(w)
for a in w:
	w = w[len(w) - 1] + w
	w = w[:len(w) - 1]
	differen.append(w) if w not in differen else True
print(len(differen))


s = list(input())
words = []
words.append(''.join(s))
for a in range(len(s)):
	s.insert(0, s[-1])
	s.pop(-1)
	words.append(''.join(s))
print(len(set(words)))


s = input()
x = [s[i:] + s[:i] for i in range(len(s))]
print(len(set(x)))


x = input()
st = set()
for i in range(len(x)):
	se = x[len(x) - 1] + x[0:len(x) - 1]
	st.add(se)
	x = se
print(len(st))


s = input()
arr = [s]
length = len(s)
count = 1
for i in range(1, length):
	s = s[-1] + s[:length - 1]
	if s not in arr:
		count += 1
		arr.append(s)
print(count)


s = input()
n = len(s)
a = [s]
s += s
for i in range(n):
	tst = 0
	for j in a:
		if s[i:i + n] == j:
			tst = 1
			break
	if tst == 0:
		a.append(s[i:i + n])
print(len(a))


s = input()
r = set()
for _ in s[:]:
	s = s[1:] + s[0:1]
	r = r | {s}
print(len(r))


s = input()
ss = set()
for i in range(len(s)):
	ss.add(s[i:] + s[:i])
print(len(ss))


a = set()
s = input()
ans = 0
n = len(s)
for i in range(n):
	if not s in a:
		a.add(s)
		ans += 1
	s = s[n - 1] + s[:n - 1]
print(ans)


x = input()
l = [x]
x = list(x)
for i in range(len(x) - 1):
	x.insert(0, x.pop())
	if not ''.join(x) in l:
		l.append(''.join(x))
print(len(l))


import sys

def shift(s):
	new = ['1'] * len(s)
	new[0] = s[-1]
	for i in range(len(s) - 1):
		new[i + 1] = s[i]
	return ''.join(new)
fin = sys.stdin
fout = sys.stdout
s = fin.readline().strip()
newS = set()
newS.add(s)
curS = s
for i in range(len(s) + 3):
	curS = shift(curS)
	newS.add(curS)
fout.write(str(len(newS)))


s = input()
dct = {}
for i in range(len(s)):
	a = s[i:] + s[:i]
	if a not in dct:
		dct[a] = 1
print(sum(dct.values()))


line = input()
length = len(line)
words = [line]
for i in range(length):
	line = line[-1] + line[:length - 1]
	if line not in words:
		words.append(line)
print(len(words))


s = input()
l = []
l.append(s)
for i in range(0, len(s)):
	new = s[-1] + s[:len(s) - 1]
	if new not in l:
		l.append(new)
		s = new
print(len(l))


s = input()
for i in range(1, len(s) + 1):
	if s == s[i:] + s[:i]:
		print(i)
		break


s = input()
k = s
l = []
l.append(s)
j = 0
c = 1
while j < len(s) - 1:
	s = s[len(s) - 1] + s[0:len(s) - 1]
	if s not in l:
		l.append(s)
		c = c + 1
	j = j + 1
print(c)


s = input()
n = len(s)
v = set()
for i in range(n):
	t = s[1:n] + s[0]
	v.add(t)
	s = t
print(len(v))


l = list(input())
x = []
y = l[:]
for i in range(len(l)):
	y = list(y[-1]) + y[:-1]
	x.append(''.join(y))
print(len(set(x)))


s = input()
l = len(s)
ks = []
for i in range(1, l):
	if l % i == 0:
		ks.append(i)
res = len(s)
for k in ks:
	if s[:k] * int(len(s) / k) == s:
		res = k
		break
print(res)


s = input().strip()
sss = set()
for x in range(len(s)):
	sss.add(s[x:] + s[:x])
print(len(sss))


st = input()
tab = []
for i in range(len(st)):
	tab.append(st)
	st = st[-1:] + st[:-1]
print(len(set(tab)))


s = list()
inp = input()
for i in range(len(inp)):
	s.append(inp)
	inp = inp[1:] + inp[0]
print(len(set(s)))


s = list(map(str, input()))
n = list(s)
l = len(s)
c = 0
for i in range(l):
	n.insert(0, n[-1])
	n.pop()
	c += 1
	if n == s:
		break
print(c)


st = input()
dic = {}
l = len(st)
for i in range(l, 0, -1):
	if st[i:] + st[:i] in dic:
		pass
	else:
		dic[st[i:] + st[:i]] = 1
print(sum(dic.values()))


s = input()
w = s
x = s[len(s) - 1]
s = x + s[:len(s) - 1]
if s != w:
	ans = 2
else:
	ans = 1
while s != w:
	x = s[len(s) - 1]
	s = x + s[:len(s) - 1]
	if s != w:
		ans += 1
print(ans)


text = input()
words = set()
for i in range(len(text)):
	words.add(text[i:] + text[:i])
print(len(words))


a = input()
b = []
k = 0
t = False
n = len(a)
temp = ''
for i in range(n):
	for j in b:
		if j == a:
			t = True
	if not t:
		k += 1
		b.append(a)
	temp = a
	a = '' + temp[n - 1] + temp[0:n - 1]
	t = False
print(k)


str = input()
l = len(str)
m = {}
for i in range(1, l + 1):
	ch = str[l - 1:l]
	st = str[0:l - 1]
	ch += st
	if not ch in m:
		m[ch] = 1
	str = ch
print(len(m))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
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 list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def main():
	s = S()
	r = set()
	while s not in r:
		r.add(s)
		s = s[-1] + s[:-1]
	return len(r)
print(main())


str = input()
cycle = set()
for i in range(0, len(str)):
	cycle.add(str[i:] + str[:i])
print(len(cycle))


s = str(input())
n = len(s)
L = [s]

def ok(L, s):
	for x in L:
		if x == s:
			return 0
	return 1
for i in range(n):
	s = s[1:] + s[0]
	if ok(L, s):
		L += [s]
print(len(L))


def main():
	w = input()
	words = set()
	for i in range(len(w)):
		words.add(w[i:] + w[:i])
	return len(words)
print(main())


c = 1
d = input('')
r = d[-1] + d[0:-1]
while r != d:
	r = r[-1] + r[0:-1]
	c += 1
print(c)


comb = []
string = input()
comb.append(string)
new_string = string
while True:
	new_string = new_string[-1] + new_string[0:-1]
	if new_string not in comb:
		comb.append(new_string)
	else:
		break
print(len(comb))


a = str(input())
b = []
c = len(a)
for i in range(c):
	a = a[c - 1:c] + a[0:c - 1]
	b.append(a[c - 1:c] + a[0:c - 1])
print(len(set(b)))


string = input()
str1 = string
str2 = ''
count = 0
while True:
	count += 1
	str2 = str1[0]
	str1 = str1[1:len(str1)] + str2
	if str1 == string:
		break
print(count)


my_str = input()
my_list = list(my_str)
ans_list = [my_str]
for i in range(1, len(my_str)):
	temp = my_list.pop()
	my_list.insert(0, temp)
	ans_list.append(''.join(my_list))
my_set = set(ans_list)
print(len(my_set))


z = []
s = list(input())
count = 0
x = 0
while True:
	s = [s[-1]] + s[:-1]
	if s in z:
		print(count)
		break
	else:
		z.append(s)
	x += 1
	count += 1


s = set()
l = input()
st = [i for i in l]
for i in range(len(st)):
	l = st.pop()
	st.insert(0, l)
	s.add(''.join(st))
print(len(s))


s = input()
s2 = ''
k = len(s) - 1
count = 0
while k >= 0:
	if s == s2:
		break
	elif s2 == '':
		s2 = s
	s = s[len(s) - 1] + s[:len(s) - 1]
	k -= 1
	count += 1
print(count)


x = input()
a = set()
a.add(x)
for i in range(len(x)):
	y = x[len(x) - 1] + x[:-1]
	a.add(y)
	x = y
print(len(a))


ch = input()
l = [ch]
s = 1
for i in range(len(ch)):
	ch = ch[len(ch) - 1] + ch[:len(ch) - 1]
	if ch not in l:
		l.append(ch)
		s = s + 1
print(s)


s = input()
d = {}
n = len(s)
counter = 0
for i in range(n):
	s2 = ''
	for j in range(n):
		s2 += s[(i + j) % n]
	if s2 not in d:
		d[s2] = 1
		counter += 1
print(counter)


s = input()
l = []
l.append(s)
j = 0
while j < len(s) - 1:
	y = ''
	y = s[len(s) - 1]
	i = 1
	while i < len(s):
		y = y + s[i - 1]
		i = i + 1
	if y not in l:
		l.append(y)
	s = y
	j = j + 1
print(len(l))


a = input()
print(len(set([a[x:] + a[:x] for x in range(len(a))])))


word = input()
words = set()
words.add(word)
for (i, letter) in enumerate(word):
	i += 1
	new_word = word[-i:] + word[:-i]
	words.add(new_word)
print(len(words))


s = input()
c = ''
d = 0
s1 = s
while c != s1:
	d += 1
	c = s[1:] + s[:1]
	s = c
print(d)


s = input()
x = False
ss = ''
if s.count(s[0]) == len(s):
	print(1)
	x = True
else:
	for i in s:
		ss += i
		if s.count(ss) * len(ss) == len(s):
			print(len(ss))
			x = True
			break
if x == False:
	print(len(s))


s = input()
temp = []
temp.append(s)
l = len(s)
for i in range(0, l):
	p = ''
	for j in range(1, l):
		p = p + s[j]
	p = p + s[0]
	s = p
	if p not in temp:
		temp.append(p)
print(len(temp))


stc = list(input())
st = stc
l = []
n = len(st)
for _ in range(n):
	stc.insert(0, stc[n - 1])
	stc.pop()
	si = ''.join(stc)
	if si not in l:
		l.append(si)
print(len(l))


s = list(input())
n = len(s)
dict = {}
res = 0
for i in range(n):
	tmp = ''.join(s)
	if dict.get(tmp) == None:
		dict[tmp] = 1
		res += 1
	s.insert(0, s[n - 1])
	s.pop(n)
print(res)


s = input()
strings = [s]
count = 1
le = len(s)
for i in range(le):
	ch = s[-1]
	s = ch + s[0:le - 1]
	if not s in strings:
		count += 1
		strings.append(s)
print(count)


word = input()
cyclone = word
count = 0
while True:
	count += 1
	cyclone = cyclone[-1] + cyclone[:-1]
	if word == cyclone:
		break
print(count)


import sys
import math
import heapq
import bisect
from collections import Counter
from collections import defaultdict
from io import BytesIO, IOBase
import string

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None
		self.BUFSIZE = 8192

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
a = input()
b = a + a
ans = b.find(a, 1)
print(ans)


s = input()
a = [s]
for i in range(len(s) - 1):
	s = s[-1] + s[0:len(s) - 1]
	if s not in a:
		a += [s]
print(len(a))


s = input()
res = 1
buf = s[-1] + s[:len(s) - 1]
while buf != s:
	res += 1
	buf = buf[-1] + buf[:len(buf) - 1]
print(res, end='')


s = input()
e = s
ss = set()
for i in range(len(s)):
	e = e[-1] + e[:-1]
	ss.add(e)
print(len(ss))


alph = 'abcdefghijklmnopqrstuvwxyz'
s = str(input())
arr = [s]
for i in range(len(s)):
	s = s[1:len(s)] + s[0]
	arr.append(s)
print(len(list(set(arr))))


s = input()
n = len(s)
S = {s}
for i in range(n):
	s = s[-1] + s[:-1]
	S.add(s)
print(len(S))


IN = input()
print(len(set([IN[-i:] + IN[:-i] for i in range(len(IN))])))


import sys, math, string, fractions, functools, collections, copy
sys.setrecursionlimit(10 ** 7)
RI = lambda x=' ': list(map(int, input().rstrip().split(x)))
RS = lambda x=' ': input().rstrip().split(x)
dX = [-1, 1, 0, 0, -1, 1, -1, 1]
dY = [0, 0, -1, 1, 1, -1, -1, 1]
mod = int(1000000000.0 + 7)
eps = 1e-14
MAX = 1010
s = input().rstrip()
d = {}
for i in range(len(s)):
	d[s[i:] + s[:i]] = 0
print(len(d))


big_lst = []
s = input()
big_lst.append(s)
len_s = len(s)
for i in range(len_s):
	s = s[-1] + s[:-1]
	if s not in big_lst:
		big_lst.append(s)
print(len(big_lst))


s = input()
print(len(set([s[i:] + s[:i] for i in range(len(s), 0, -1)])))


s = input()
cs = set()
for i in range(len(s)):
	s = s[-1] + s[:-1]
	cs.add(s)
print(len(cs))


s = input()
total = set()
for i in range(0, len(s)):
	total.add(s[i:] + s[:i])
print(len(total))


from operator import itemgetter
s = input()
strs = set()
for i in range(len(s)):
	strs.add(s[-i:] + s[:-i])
print(len(strs))


a = input()
from collections import defaultdict
dict = defaultdict(int)
for i in range(len(a)):
	dict[a] = 1
	a = a[1:] + a[:1]
print(len(dict))


n = input()
l = []
for i in range(len(n)):
	l.append(n[i])
for i in range(len(n)):
	a = l.pop()
	l.insert(0, a)
	if ''.join((j for j in l)) == n:
		print(i + 1)
		break


s = input()
s1 = list(s)
l = [s]
while 1:
	a = s1[len(s1) - 1]
	for i in range(len(s1) - 1, 0, -1):
		s1[i] = s1[i - 1]
	s1[0] = a
	s2 = ''.join(s1)
	if s2 not in l:
		l.append(s2)
	elif s2 == s:
		break
print(len(l))


s = input()
variants = [s]
for i in range(1, len(s)):
	if s[i:] + s[:i] not in variants:
		variants += [s[i:] + s[:i]]
print(len(variants))


s = input()
s2 = s * 2
a = set()
for i in range(len(s)):
	a.add(s2[i:i + len(s)])
print(len(a))


s = list(input())
aux = [0] * len(s)
for i in range(len(s)):
	aux[i] = s[i]
ans = 0
for i in range(len(s)):
	s.insert(0, s[-1])
	del s[-1]
	ans += 1
	if s == aux:
		print(ans)
		break


def principal_period(s):
	i = (s + s).find(s, 1, -1)
	return None if i == -1 else s[:i]
s = input()
a = principal_period(s)
if a is not None:
	print(len(a))
elif a is None:
	print(len(s))


s = input()
r = [s]
tempS = s
for i in range(len(s) - 1):
	tempS = tempS[-1] + tempS[:-1]
	r.append(tempS)
print(len(set(r)))


s = input()
sset = set([s])
res = 1
for i in range(len(s) - 1):
	s = s[-1] + s[0:-1]
	if not s in sset:
		sset.add(s)
		res += 1
print(res)


a = input()
b = len(a)
n = 0
c = list(a)
d = 0
e = 0
f = [a]
while n < len(a):
	d = c[b - 1]
	c.pop()
	c.insert(0, d)
	e = str(c)
	if e not in f:
		f.append(e)
	n = n + 1
print(len(f) - 1)


s = input()
(s_init, s_new) = (s, s)
i = 0
while i < len(s):
	s_new = s[-1] + s[:-1]
	i += 1
	if s_new == s_init:
		break
	s = s_new
print(i)


n = str(input())
s = set()
for i in range(len(n)):
	s.add(n[i:] + n[:i])
print(len(s))


(s, vars) = (input(), set())
vars.add(s)
for i in range(1, len(s)):
	vars.add(s[i:] + s[:i])
print(len(vars))


s = input()
l = []
n = len(s)
while n:
	n -= 1
	if s not in l:
		l.append(s)
	s = s[-1] + s[:len(s) - 1]
print(len(l))


S = input()
S1 = []
k = 0
for i in range(len(S)):
	S = S[len(S) - 1] + S[0] + S[1:len(S) - 1]
	S1.append(S)
S2 = set(S1)
print(len(S2))


lis = []
s = input()
for i in range(len(s)):
	lis.append(s[i:] + s[:i])
print(len(set(lis)))


x = input()
p = {x}
for i in range(len(x) - 1):
	x = x[-1] + x[:len(x) - 1]
	p.add(x)
print(len(p))


def shift(a):
	b = a[len(a) - 1] + a[:len(a) - 1]
	return b
lis = []
inp = input().lower()
ctr = 0
while ctr < len(inp):
	if inp not in lis:
		lis.append(inp)
	inp = shift(inp)
	ctr += 1
print(len(lis))


s = str(input())
lis = [s]
for i in range(1, len(s)):
	lis.append(s[i:] + s[0:i])
ans = len(set(lis))
print(ans)


s = input()
set1 = {s}
for i in range(0, len(s)):
	s = s[-1] + s[0:-1]
	set1.add(s)
print(len(set1))


n = input()
ans = {n}
for i in range(52):
	n = n[-1] + n[:-1]
	ans.add(n)
print(len(ans))


string = input()

def cyclicshift(string):
	ans = set()
	n = len(string)
	for i in range(n):
		ans.add(string[i:] + string[:i])
	return ans
ans = cyclicshift(string)
print(len(ans))


w = str(input().strip())
l = len(w)
k = w + w
i = k.find(w, 1)
if i == -1:
	print(l)
else:
	print(i)


s = input()
n = len(s)
reps = set()
for i in range(n):
	ss = s[1:] + s[0]
	s = ss
	reps.add(s)
print(len(reps))


S = input()
L = []
for i in range(len(S)):
	L.append(S[i:] + S[:i])
print(len(set(L)))


s = input()
known = set()
for i in range(len(s)):
	p = s[i:] + s[:i]
	known.add(p)
print(len(known))


string = input()
a = len(string)
words = set()
for x in range(a):
	words.add(string)
	letters = list(string)
	temp = letters[-1]
	del letters[-1]
	letters.insert(0, temp)
	string = ''.join(letters)
print(len(words))


s = input()
l1 = []
count = 1
l1.append(s)
for i in range(0, len(s) - 1):
	s = s[1:] + s[:1]
	if s not in l1:
		count += 1
		l1.append(s)
print(count)


s = input()
x = set()
x.add(s)
index = 0
for i in s:
	x.add(s[-1] + s[0:-1])
	s = s[-1] + s[0:-1]
	index += 1
print(len(x))


from collections import Counter
s = input()
i = len(s) - 1
h = i + 1
x = s
ans = 0
r = set()
while i >= 0:
	x = s[i] + x
	x = x[:h]
	r = r | {x}
	i -= 1
print(len(r))


s = input()
chg = s
lgt = len(s) - 1
hasil = [s]
cycle = 1
while lgt > 0:
	lgt -= 1
	chg = chg[-1] + chg[:-1]
	if chg not in hasil:
		cycle += 1
		hasil.append(chg)
print(cycle)


from sys import stdin
line = stdin.readline().rstrip()
s = set()
if len(line) == 0:
	print(0)
else:
	while line not in s:
		s.add(line)
		line = line[-1] + line[0:-1]
print(len(s))


import math
import sys
import re
s = input()
n = len(s)
l = []
x = 0
while x != n:
	s = s[-1] + s[:-1]
	l.append(s)
	x = x + 1
print(len(set(l)))


a = input()
m = set([])
for i in range(len(a)):
	x = a[i:] + a[:i]
	m.add(x)
print(len(m))


def changeword(word):
	i = word
	toge = []
	new = ''
	while i != new:
		new = ''
		long = len(word)
		for n in range(long):
			new += word[n - 1]
		if new not in toge:
			toge.append(new)
		word = new
	return toge
word = input()
answer = changeword(word)
print(len(answer))


st = input()
theset = set()
theset.add(st)
for i in range(len(st)):
	st = st[-1] + st[0:len(st) - 1]
	theset.add(st)
print(len(theset))


def main():
	s = input()
	n = len(s)
	d = {s: 0}
	for _ in range(n - 1):
		s = s[n - 1] + s[:n - 1]
		d[s] = 0
	print(len(d))
main()


a = list(input())
d = [a]
for x in range(len(a) - 1):
	b = a.copy()
	c = b[-1]
	b.pop()
	b.insert(0, c)
	if b not in d:
		d.append(b)
		a = b
print(len(d))


s = input()
n = len(s)
s = s + s
print(len(set((s[i:i + n] for i in range(n)))))


def main():
	s = input()
	k = set()
	for i in range(len(s)):
		k.add(s[i:] + s[:i])
	print(len(k))
main()


def main(s):
	n = len(s)
	se = set()
	for i in range(n):
		se.add(s[i:] + s[:i])
	return len(se)
print(main(input()))


def solve():
	global s
	x = set([s])
	for i in range(len(s)):
		s = s[-1] + s[:-1]
		x.add(s)
	return len(x)

def main():
	global s
	s = input()
	print(solve())
main()


s = list(input())
used = []
ans = 0
for i in range(len(s)):
	z = s[0]
	s.append(s[0])
	s.pop(0)
	p = ''.join(s)
	if p not in used:
		used.append(p)
		ans += 1
print(ans)


import itertools
import math
from collections import defaultdict

def input_ints():
	return list(map(int, input().split()))

def solve():
	s = input()
	n = len(s)
	ans = set()
	for i in range(n):
		ans.add(s)
		s = s[-1] + s[:n - 1]
	print(len(ans))
solve()


(s, v) = (input(), set())
while s not in v:
	v.add(s)
	s = s[-1] + s[:-1]
print(len(v))


text = input()
l = len(text)
text += text
allwords = set()
for i in range(l):
	s = text[i:i + l]
	allwords.add(s)
print(len(allwords))


w = []
s = input()
w.append(s)
wordlength = len(s)
s = s + s[0:wordlength - 1]
for i in range(1, wordlength):
	word = s[i:i + wordlength]
	if word not in w:
		w.append(word)
print(len(w))


n = input()
l = []
for i in range(len(n)):
	n = n[-1] + n[:-1]
	if n in l:
		continue
	else:
		l.append(n)
print(len(l))


import math as mt
import sys, string, bisect
input = sys.stdin.readline
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
n = input().strip()
s = set([])
for i in range(len(n)):
	d = n[-1] + n[:-1]
	n = d[:]
	s.add(d)
print(len(s))


s = str(input())
l = len(s)
test = []
final = []
new = ''
for i in range(l):
	new = s[1:] + s[0]
	s = new
	test.append(new)
for i in test:
	if i not in final:
		final.append(i)
print(len(final))


class CyclicShifter:

	def calculate(self, source_string):
		length = len(source_string)
		uniqs = set()
		shifted = source_string[-1] + source_string[:-1]
		for i in range(0, length):
			uniqs.add(shifted)
			shifted = shifted[-1] + shifted[:-1]
		return len(uniqs)
source_string = input()
shifter = CyclicShifter()
print(shifter.calculate(source_string))


s = str(input())

def extract(index):
	result = ''
	for j in range(len(s)):
		result += s[index]
		index += 1
		if index == len(s):
			index = 0
	return result
List = []

def find(st):
	for j in range(len(List)):
		if List[j] == st:
			return True
	return False
for j in range(len(s)):
	st = extract(j)
	if find(st) == False:
		List.append(st)
print(len(List))


s = input()
our = set()
for i in range(50):
	our.add(s)
	s = s[-1] + s[:-1]
print(len(our))


s = input()
from collections import deque
s = deque(s)
temp = s.copy()
temp.rotate()
count = 1
while s != temp:
	temp.rotate()
	count += 1
print(count)


s = input()
res = set()
for i in range(len(s)):
	res.add(s[-i if i else len(s):] + s[:len(s) - i])
print(len(res))


ar = []
text = input()
for i in range(len(text)):
	text = text[-1] + text[:-1]
	if text not in ar:
		ar.append(text)
print(len(ar))


s = input()
se = set()
for _ in range(51):
	se.add(s)
	sl = s[1:]
	s = sl + s[0]
print(len(se))


from collections import deque
X = deque(input())
Y = set()
for i in range(len(X)):
	Char = X.pop()
	X.appendleft(Char)
	Y.add(str(X))
print(len(Y))


s = str(input())
ss = set()
for i in range(len(s)):
	ss.add(s[i:] + s[0:i])
print(len(ss))


a = input()
l = []
for i in range(len(a)):
	s = a[i:] + a[:i]
	if s not in l:
		l.append(s)
print(len(l))


a = input()
s = []
count = 0
while a not in s:
	s.append(a)
	a = a[-1] + a[:-1]
	count += 1
print(count)


s = input()
a = set()
while s not in a:
	a.add(s)
	s = s[-1] + s[:-1]
print(len(a))


a = input()
b = list(a)
c = len(b)
d = 0
e = ''
f = ''
g = 0
while g < c:
	while d < c:
		e = e + str(b[d])
		d = d + 1
	if f.find(e) >= 0:
		pass
	else:
		f = f + ' ' + e
	d = 0
	e = ''
	b = [b.pop()] + b
	g = g + 1
f = f.split()
print(len(f))


def f(s):
	a = set()
	for i in range(len(s)):
		x = s[i:] + s[:i]
		assert len(x) == len(s)
		a.add(x)
	return len(a)
assert f('abcd') == 4
assert f('bbb') == 1
s = input()
ans = f(s)
print(ans)


from collections import Counter
s = input()
counter = Counter()
for i in range(len(s)):
	counter[s[i:len(s)] + s[0:i]] = 1
print(sum(counter.values()))


from collections import Counter
s = input()
z = set()
for i in range(len(s)):
	s = s[1:] + s[:1]
	z.add(s)
print(len(Counter(z)))


n = input()
v = ''
lst = []
lst1 = []
for i in n:
	lst.append(i)
while True:
	lst.append(lst[0])
	lst.remove(lst[0])
	for j in lst:
		v += j
	if v not in lst1:
		lst1.append(v)
		v = ''
	else:
		break
print(len(lst1))


s = input()
sn = s
n = 1
while True:
	sn = sn[-1] + sn[:-1]
	if sn != s:
		n += 1
	else:
		break
print(n)


s = input()
s = s + s
d = {}
for i in range(int(len(s) / 2)):
	d[s[i:i + int(len(s) / 2)]] = 1
print(len(d))


n = input()
list = [n]
for i in range(len(n) - 1):
	n = n[-1] + n[:-1]
	list.append(n)
print(len(set(list)))


(s, w, count) = (list(input()), [], 1)
w.extend(s)
while True:
	s.insert(0, s.pop(-1))
	if w != s:
		count += 1
	else:
		print(count)
		break


def solveMeFirst(a):
	cycle = a[len(a) - 1] + a[:len(a) - 1]
	times = 0
	while a != cycle:
		temp = cycle[:]
		cycle = temp[len(a) - 1] + temp[:len(a) - 1]
		times += 1
	return times + 1
num1 = input()
res = solveMeFirst(num1)
print(res)


s = input()
S = set()
for _ in range(len(s)):
	S |= {s}
	s = s[1:] + s[0]
print(len(S))


import sys
string = input()
string2 = []
string2.append(string)
lastword = string
cnt = 1
for ch in range(len(string)):
	word = lastword[-1] + lastword[0:-1]
	if word not in string2:
		string2.append(word)
		cnt += 1
	lastword = word
print(cnt)


n = input()
l = [n]
x = len(n)
for i in range(x):
	z = ''
	n = n[x - 1] + n[:x - 1]
	l.append(n)
print(len(set(l)))


word = input()
aux = word
n = len(word)
res = 1
while True:
	word2 = aux[n - 1] + aux[0:n - 1]
	if word2 != word:
		res += 1
		aux = word2
	else:
		break
print(str(res))


n = input()
s = [n]
b = []
a = len(n) - 1
for i in range(-1, -len(n), -1):
	b += n[i]
	s.append(''.join(reversed(b)) + n[:a])
	a -= 1
print(len(list(dict.fromkeys(s))))


s = input()
x = set()
length = len(s)
for i in range(length):
	ss = s[i:] + s[:i]
	x.add(ss)
print(len(x))


def divs(n):
	result = [1]
	for i in range(2, n + 1):
		if n % i == 0:
			result.append(i)
	return result
s = input()
n = len(s)
lengths = divs(n)
for i in lengths:
	if s == s[:i] * (n // i):
		print(i)
		break


s = input()
t = set()
N = len(s)
t.add(s)
for i in range(N):
	s = s[1:] + s[0]
	t.add(s)
print(len(t))


s = input()
d = set()
for _ in range(len(s)):
	d.add(s)
	s = s[-1] + s[:-1]
print(len(d))


a = input()
r = ['']
for i in range(len(a)):
	s = a[len(a) - 1] + a[:len(a) - 1]
	a = s
	if a not in r:
		r.append(a)
print(len(r) - 1)


a = input()
s = set()
i = 0
s.add(a)
x = ''
while x != a:
	x = a[i + 1:] + a[0:i + 1]
	s.add(x)
	i += 1
print(len(s))


a = input()
t = a
r1 = len(a)
for i in range(len(a)):
	a = a[r1 - 1] + a[0:r1 - 1]
	if a == t:
		break
print(i + 1)


string = input()
wordList = set()
currString = string[-1] + string[:-1]
res = 1
while currString != string:
	res += 1
	currString = currString[-1] + currString[:-1]
print(res)


a = []
str = input()
for k in range(len(str)):
	s = ''
	s += str[len(str) - 1]
	for i in range(0, len(str) - 1):
		s += str[i]
	a.append(s)
	str = s
a = set(a)
print(len(a))