WA in CONVSTR

My solution: CodeChef: Practical coding for everyone

where am I going wrong??

Well, the first place you went wrong was asking for help instead of debugging it for yourself, but that’s in the past now.

Your issue is that you aren’t making the minimum possible number of operations, for example, if you need to change two b's to a's, your program will do it in two separate operations instead of changing them both in a single operation.