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 cal(n):
	if n == 0 or n == 1:
		return 1
	return n*cal(n-1)

s = raw_input()
dt = {}
for i in xrange(len(s)):
	for j in xrange(i,len(s)):
		#print s[i:j]
		if s[i:j+1] in dt :
			pass
		else:
			dt[s[i:j+1]] = 1

print len(dt)