An Easy Python Solution


#1

def solve(self, A):
c=0
for i in range(len(A)):
if(A[i] in [‘A’,‘E’,‘I’,‘O’,‘U’,‘a’,‘e’,‘i’,‘o’,‘u’]):
c=c+(len(A)-i)
return c%10003


#2

hey why u should modulus with 10003 can u explain it


#3

Will you read the question again ,please?


#4

As per the question output should be :
“Return a single integer X mod 10003, here X is number of Amazing Substrings in given string.”
That’s why the returned value is c%10003.
Please read the question again.


#5

As it is required to get the correct output, but i think the other reason as it is mentioned in the constraints the input may be large upto 1e6 to get it reduced to integer range mod 10003 is performed