intelligent-girl-1

Soumika has a string S and its starting index is 1. The string S consists of characters from 1-9. As she is very intelligent, she wants to test his brother Vinay Tendulkar. She asked her brother Vinay Tendulkar to count the number of even numbered characters ( i.e  2,4,6,8 ) for every index i   (1 ≤  i  ≤ | S|). For an index i, the result should be calculated from i to the end of the string. As Vinay doesn't know  about programming, he wants you to help him find the solution.   

Input:
First line contains a string  S. 

Output:
Print |S| space-separated integers,the result of every index.

Constraints:
1 ≤ |S| ≤ 10^4

SAMPLE INPUT
574674546476

SAMPLE OUTPUT
7 7 7 6 5 5 4 4 3 2 1 1

Explanation

Given string S is 574674546476.
for index 1
Number of even numbers from 5 to end of the  string is 7 so the result of  index 1 is 7.
for index 2
Number of even numbers from 7 to end of the  string is 7  so the result of  index 2 is 7.
for index 3
Number of even numbers from 4 to end of the  string is 7 so the result of  index 3 is  7.
for index 3
Number of even numbers from 6 to end of the  string is  6 so the result of  index 4 is  6.....
...

Difficulty: EASY
Tags: Implementation

Ad-hoc

Starter code:

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

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
string=input()
count=0
a=[]
for i in range(len(string)):
	if(int(string[i])%2==0):
		count=count+1
a.append(count)
for i in range(1,len(string)):

	if(int(string[i])%2==0 and int(string[i-1])%2==0):
		count=count-1
		a.append(count)
	elif(int(string[i])%2==0 and int(string[i-1])%2!=0):
		
		a.append(count)
	elif(int(string[i])%2!=0 and int(string[i-1])%2==0):
		count=count-1
		a.append(count)
	else:
		a.append(count)
		
	
final=" ".join(str(i) for i in a)
print(final)


a=[int(x) for x in input() ]
a.reverse()
b,c=[],0
for x in a :
	if x%2==0:
		c+=1
	b.append(c)
for x in b[::-1]:
	print(x, end=' ')



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

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
x = eval(input())
y = ""
c = 0 
while x!=0 :
	z = x%10
	if z%2==0:
		c = c+1
	y = " "+ str(c) + y;
	x = x/10
print(y)


s = list(input())
c = 0
ans= ''
for i in s:
	if int(i)%2 == 0:
		c = c + 1
ans = ans+str(c)+' '
j = 1
while j<len(s):
	if int(s[j-1])%2 == 0:
		c = c-1
		ans = ans+str(c)+' '
	else:
		ans = ans+str(c)+' '
	j = j + 1
print(ans)    
		


S = list(map(int,list(input())))
dummy = []
j = 0
for i in S[::-1]:
	if i%2 == 0:
		j = j + 1
	dummy.append(j)
for i in dummy[::-1]:
	print(i, end=' ')
	


s=input()
a=list(s)
b=list(map(int,a))
k=0
s=""
for i in range(len(a)-1,-1,-1):
	if(b[i]%2==0):
	  k=k+1
	  s=s+str(k)  	
	  s=s+" "
	else:
	  s=s+str(k)
	  s=s+" "  	
s=s.strip()	 
k=s.split(" ")
d=k[::-1]
m=' '.join(d)
print(m)


	  


num=input()
num=list(num)
c=0
for i in num:
	if not int(i)&1:
		c+=1
for i in num:
	if int(i)&1:print(c, end=' ')
	else:
		print(c, end=' ')
		c-=1


s=input()
d={}
c=0
for i in range(len(s)-1,-1,-1):
	if int(s[i])%2==0:
		c+=1
	d[i]=c
d1=list(d.keys())
p=''
for j in d1:
	p+=str(d[j])+' '
print(p)


string = input()
count = 0
for each in string:
	if int(each) % 2 == 0:
		count += 1
for each in string:
	print(count, end=' ')
	if int(each) % 2 == 0:
		count -= 1


def check(strng):
	even=0
	for x in strng:
		if(int(x)%2==0):
			even=even+1
	return even
strng=input()
even=check(strng)
for x in (strng):
	print((even), end=' ')
	if(int(x)%2==0):
		even=even-1


def counteven(arr):
	c=0
	for i in arr:
		if i%2 == 0:
			c+=1
	return c
s=input()
s=list(map(int,list(s)))
c=counteven(s)
for i in range(len(s)):
	print(c, end=' ')
	if s[i]%2 == 0:
		c-=1
	
	


s=input()
s=s[::-1]
count=0
even_counter=[]
for i in s:
	if(int(i)%2==0):
		count+=1
	even_counter.append(count)
for i in range(len(even_counter)-1,-1,-1):
	print(even_counter[i], end=' ')


s = input()
n = len(s)
a = [0] * (n+1)
i = 2
while i <= n+1:
	if int(s[-i+1]) % 2 == 0:
		a[-i] = a[-i+1] + 1
	else:
		a[-i] = a[-i+1]
	i += 1
for e in a[:-1]:
	print(e, end=' ')
		
	


string1=input()
count = 0
for i in string1:
	if(int(int(i)%2)==0):
		count=count+1
for x in string1:
	print(count, end=' ')
	if(int(int(x)%2)==0):
		
		count=count-1


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

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''

S = str(eval(input()))

mapping = [0] * len(S)

for idx, char in enumerate(S):
	if not int(char)&1:
		mapping[idx] = 1
		
for i in range(len(S)-1, 0, -1):
	mapping[i-1] += mapping[i]
	
print(' '.join([str(x) for x in mapping]))


b=list()
count=0
a=[int(x) for x in input()]
l=len(a)
for i in range(0,l,1):
	if(a[l-i-1]%2==0):
		count+=1
	b.append(count)
for i in b[::-1]:
	  print(i, end=' ')
	




s=input()
n=len(s)
cc=[(int(x)+1)%2 for x in s]
for x in range(n-2,-1,-1):
	cc[x]+=cc[x+1]
print(" ".join(map(str,cc)))


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

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
n = input()
n=list(map(int,n))
str1=""

#print n
count=0
for i in range(len(n)):
	if n[i]==2 or n[i]==4 or n[i]==6 or n[i]==8:
		count=count+1
for i in range(len(n)):
	#print i
	#for j in range(0,i+1):
	if n[i]==2 or n[i]==4 or n[i]==6 or n[i]==8:
		#print count
		str1=str1+(str(count))+" "
		#print str1
		
		count=count-1
	else:
		#print count
		str1=str1+(str(count))+" "
print(str1)


s=input()
s=s[::-1]
count=0
even_counter=[]
for i in s:
	if(int(i)%2==0):
		count+=1
	even_counter.append(count)
for i in reversed(even_counter):
	print(i, end=' ')


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

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
def main():
	l = ['2','4','6','8'] 
	s = input()
	rev_s = s[::-1]
	
	opt = ""
	c = 0
	
	for i in rev_s:
		if i in l:
			c = c+1 
		opt = str(c)+" "+opt
		
	
	print(opt)
	
	
if __name__=="__main__":
	main()


s=input('')
count=0
for i in range(len(s)):
	x=int(s[i])
	if x%2==0:
		count=count+1
for i in range (len(s)):
	x=int(s[i])
	print(count, end=' ')
	if x%2==0:
		count=count-1