Sort string by length C++
Can anyone help me how to write a code for sorting a list of names from a txt file by length? Just the function and implementation. For example: input: 1 Angel 2 Lucifer 3 Bob 4 Valentina Output: 3 Bob 1 Angel 2 Lucifer 4 Valentina *i can only use the <iostream>, <fstream> libraries and nothing else. Thanks!