My data is like this and i want to get an output like this :-
and i want to make sure that running the program will solve the problem when new data is