Problem: You are given a string S. Find the number of different substrings in S.

Input
One line containing a string S consisting of lowercase Latin letters.

Output
Output one integer - answer to the question.

Constraints
1 ≤ length of S ≤ 1200

SAMPLE INPUT
abc

SAMPLE OUTPUT
6

Solution (in PYTHON):

Solution:
def get_all_substrings(input_string):
  length = len(input_string)
  return [input_string[i:j+1] for i in xrange(length) for j in xrange(i,length)]
s=raw_input()
l=get_all_substrings(s)
l=sorted(l)
x=[]
x.append(l[0])
j=0
for i in range(1,len(l)):
	if l[i]!=x[j]:
		x.append(l[i])
		j+=1
print len(x)