Why my code is giving error.
String sort, Compilation problem
@anonymous_pk7 strcmp and strcpy funstions are only for c style strings that is character array. These functions will not work for string data type.
For string type, these are the valid functions https://www.geeksforgeeks.org/strings-library-in-cpp-stl/
For this question you can make an array of strings and then sort it according to the condition that if there is a prefix match between two string, sort in decreasing order of length. Use C++ inbuilt sort function with a custom comparator.
Follow this implementation: