| 10 | } |
| 11 | |
| 12 | int main() { |
| 13 | int t; |
| 14 | cin>>t; |
| 15 | while(t--) |
| 16 | { int p,q; |
| 17 | string s; |
| 18 | cin>>s; |
| 19 | cin>>p>>q; // given vowels and consonants |
| 20 | int con=0,vow=0; // total vowels and consonants in the starting |
| 21 | for(int k=0;k<s.length();k++) // count the number of vowels and consonants |
| 22 | { if(s[k]=='a' || s[k]=='e' || s[k]=='i' || s[k]=='o' || s[k]=='u' || s[k]=='A' || s[k]=='E' || s[k]=='I' || s[k]=='O' || s[k]=='U') |
| 23 | vow++; |
| 24 | else |
| 25 | con++; |
| 26 | } |
| 27 | // calculating C(con,p) in a1 and C(vow,q) in a2 |
| 28 | long int x1=fact(p); |
| 29 | long int y1=fact(con); |
| 30 | long int z1=fact(con-p); |
| 31 | long int a1= y1/(x1*z1); |
| 32 | long int x2=fact(q); |
| 33 | long int y2=fact(vow); |
| 34 | long int z2=fact(vow-q); |
| 35 | long int a2= y2/(x2*z2); |
| 36 | |
| 37 | long int ans=a1*a2*fact(p+q); // total arrangements possible |
| 38 | cout<<ans<<endl; |
| 39 | } |
| 40 | return 0; |
| 41 | } |