substring-5

A substring is a string of characters that is contained in another string. For example, the substrings of "abcdef" could be "abc", "bc", "cdef", "e" and so on. But, "bca", "ace", and "g" are not substrings of "abcdef". 

Your task is to count the number of non-empty substrings possible of a given string such that all characters in that substring are same. If two substrings contains same alphabets but appear at different positions in that given string, they are still considered to be different. 

Input

A single string without spaces

Output

a single integer denoting the number of substrings as described above

Constraints
length of string will be between 1 and 100
all characters of string will be small case alphabets only

SAMPLE INPUT
xxxyx

SAMPLE OUTPUT
8

Explanation

four occurrences of substring "x"

one occurrence of substring "y"

two occurrences of substring "xx"  

one occurrence of substring "xxx"

= total 8

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
a=input()
c=0
for i in range(len(a)):
	for j in range(len(a)+1):
		if len(set(a[i:j]))==1:
			c+=1
print(c)			


a=input()
l=len(a)
c=0
for i in range(l):
	for j in range(l):
		if len(set(a[i:j+1]))==1:
			c=c+1
print(c)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
s=input()
c=0
r=0
for i in range(1,len(s)):
	if s[i]==s[i-1]:
		c=c+1
	else:
		c=c+1
		r=r+((c*(c+1))//2)
		
		c=0

c=c+1
r=r+((c*(c+1))//2)	
print(r)		


def check(s1):
	for i in range(len(s1)):
		for j in range(i+1,len(s1)):
			if s1[i]!=s1[j]:
				return 0
	return 1
s=input()
dc={}
for i in range(len(s)):
	t=i
	while t<len(s):
		s1=s[i:t+1]
		if s1 not in dc and check(s1):
			dc[s1]=1
		else:
			if check(s1):
				dc[s1]+=1
		t=t+1
l=list(dc.values())
print(sum(l))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
s=input()
c=0
for i in range(len(s)):
	for j in range(i,len(s)):
		x=s[i:j+1]
		if len(set(list(x)))==1:
			c+=1
print(c)


def main():
	x=input()
	c=1
	ans=0
	p_c=x[0]
	for i in range(1,len(x)):
		if x[i]==p_c:
			c+=1
		else:
			ans+=(c*(c+1))/2
			c=1
		p_c=x[i]
	ans+=(c*(c+1))/2
	print(ans)

if __name__=='__main__':
	main()


s=input()
ans=0
for i in range(len(s)):
	for j in range(len(s)):
		if len(set(s[i:j+1]))==1:
			ans+=1
print(ans)


def get_all_substrings(input_string):
	length = len(input_string)
	return [input_string[i:j+1] for i in range(length) for j in range(i,length)]

s = input()
count = 0
flag = 0
rs = get_all_substrings(s)
for w in rs:
	flag = 0
	if len(w) == 1:
		count +=1
	else:
		for i in range(1):
			for j in range(len(w)):
				if w[i] == w[j]:
					flag += 1
		if flag	== len(w):
			count += 1
			
print(count)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
s=input()
c=0
for i in range(len(s)):
	for j in range(i,len(s)):
		x=s[i:j+1]
		if len(set(list(x)))==1:
			c+=1
print(c)


s = input()
count=1
ans=0
for i in range(0,len(s)-1):
	if s[i]==s[i+1]:
		count+=1
	else:
		ans+= (count*(count+1))/2
		count=1
ans+=(count*(count+1))/2
print((int(ans)))


word = input()

lt = len(word)
count = 0
i,j = 0,1
#p = 0
while i != lt:
	temp = word[i:j]
	if len(temp) == 1:
		count += 1
	elif len(set(temp)) == 1:
		count += 1
		
	j += 1

	if j > lt:
		i += 1
		j = i+1

	#p += 1
print(count)


def main():
	s=input()
	ans=len(s)
	l=len(s)
	c=1
	i=1
	while i<l:
		if s[i]==s[i-1]:
			c=c+1
		else:
			if c>0:
				ans=ans+ ((c-1)*c)/2
			c=1
		i=i+1
	if c>0:
		ans=ans+ ((c-1)*c)/2
	print(ans)
if __name__=="__main__":
	main()