Pliz give inputs for which it is wrong so that i can correct

@sgdon142
Add these line just after while(cin>>n)
ma.clear();
inv_ma.clear();
for(int i=0;i<105;i++){
adj[i].clear();
vis[i]=false;
indegree[i]=0;
}

also not working for 1 case

@sgdon142
Consider this testcase
5
A
B
C
D
E
5
C A
D A
B D
E B
E C
Output array should be “E B C D A” but your code is giving " A B C D E "

@sgdon142
Use topological sort here.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.