Python3 代码
while True:
s = input()
if s == ".":
break
n = len(s)
for i in range (n):
if n % (i+1) == 0:
sub = s[:i+1]
c = n // (i+1)
sp = ""
for j in range (c):
sp += sub
j += 1
if s == sp:
print (c)
break