A
number N is passed as input to the program. If N has odd number of digits, the
program must print "NotAccepted" and exit. If N has even number of
digits, the program must print the sum of digits in odd position and also must
print the sum of digits in the even position.
Input Format:
The
first line contains the value of N
Output Format:
The
first line contains the sum of digits in the odd positions or the value
"NotAccepted"
The
second line (if Accepted) contains the sum of digits in the even positions.
Example Input/Output 1:
Input:
1234
Output:
4
6
Example Input/Output 2:
Input:
156
Output:
NotAccepted
Solution:
n = input()
o = 0
e = 0
if len(n)%2 != 0:
print("NotAccepted")
else:
for i in range(len(n)):
if i % 2 == 0:
o += int(n[i])
else:
e += int(n[i])
print(o)
print(e)
o = 0
e = 0
if len(n)%2 != 0:
print("NotAccepted")
else:
for i in range(len(n)):
if i % 2 == 0:
o += int(n[i])
else:
e += int(n[i])
print(o)
print(e)