Dictionary order smaller

two of my test cases are not passing. I think this is because of the order in which strings are printing. how should I fix that.
here’s the code-> https://ide.codingblocks.com/s/84847


Plz refer to this code,
In your code you are printing in wrong order, thts why it is showing error