I have submitted it around 40 times, with minor changes in each submission, but it ended up in WA every time. I’m not able to detect the error in my code. It does this -
fs=qwrtyuipasdfgjkzxcvbnmheol
enc=Dummy!
visited={0,0,0,1,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,1,0,0,1,0}
i.e. 1 for ‘d’, 2 for ‘m’, 1 for ‘u’, 1 for ‘y’
a=dmuy
b={1,2,1,1}
Then I used selection sort on a and b. Sorting has been done on the basis of the contents of b.
But the elements of both a and b are swapped, so that after sorting, we get:
a=duym
b={1,1,1,2}
strcpy(decr,enc) => decr=Dummy!
finally decr=Hello!
If the judge is giving WA, then there must be some bug in my code, which I’m not able to encounter. Please help.