i managed to get the ans in sorted order but i cant able to print in the output format please check my code i have written it but how can i stop it from putting comma at the last position.
code- https://ide.codingblocks.com/s/270893
How to get output in given format
but i am using for each loop and i dont know how to itrate over inbuilt hashmap using for loop
@anubhavb11
auto start=map.begin();
auto end=map.end();
end–;
for(auto it=start;it<end;it++)
try something like this
there is a problem in it you cant figure out if the end-1 element is going to print or not
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.
