Heres what i did:
- find if all similar names are lexo sorted (i.e. those having least one char i.e. first one same (will be grouped together)), if so…
probably rearranging alphabets, a solution would be possible…
print alphas starting from ‘a’…‘z’ till first elements first char (which don’t appear in any names)
print all names first char (avoid repetition), as all similar will be grouped and are lexo-sorted as above checked else would have been impossible.
print the rest one’s (alphabets) that didn’t appear in list.
Though i tried looking at someone else code and test cases, i got the code but where can a loop occur or why do i need a dfs, if anyone could give me an example i.e. test case i will be thankful to him/her. Thanks in advance. tried it but " failed at 12th test case " , feel free to point out my mistake in
[Wrong code Link case 12 failed](http://codeforces.com/contest/510/submission/35100737) and [Problem link](http://codeforces.com/problemset/problem/510/C).
Like in first example,… print all alphabets from ‘a’ to till ‘r’ i.e. first alphabet of first name, excluding those that appear somewhere as first alphabet in any name, i.e. form ‘b’ to till ‘q’ and then all names first alphabets then again starting from ‘r’ to till ‘z’ that haven’t been printed, so solution becomes
alpha + names alpha + remaining alphas =