A Simple Trick (C plus plus)


#1

int Solution::solve(string A) {
int count=0,i,j;
int n=A.length();
for(i=0;i<n;i++){
if(A[i]==‘A’ || A[i]==‘E’ || A[i]==‘I’ || A[i]==‘O’|| A[i]==‘U’ || A[i]==‘a’ || A[i]==‘e’ || A[i]==‘i’ || A[i]==‘o’|| A[i]==‘u’){
count++;
for(j=i+1; j<n; j++)
count++;
}

}
int ans=count%10003;
return ans;

}