>>508154537puts("sorting the list by alpha...");
stable_sort(list.begin(), list.end(),
[](auto const& a, auto const& b) { return a < b; });
puts("sorting the list by size...");
stable_sort(list.begin(), list.end(),
[](auto const& a, auto const& b) { return a.size() < b.size(); });
puts("removing any duplicates...");
list.erase(unique(list.begin(), list.end(), lower_compare), list.end());
puts("titlecasing the list...");
for (auto& line : list) { // For each line in the list,
line[0] = toupper(line[0]); // transform first char to upper case.
for (auto& ch : line) { // For each char in the line,
if (*(&ch - sizeof(char)) == ' ') // if previous char was a space,
ch = toupper(ch); // transform curr char to upper case.
}
}
puts("writing sorted list...");
ofstream ofs{"sorted_list"};
for (auto const& line : list)
ofs << '>' << line << '\n';
ofs.close();
}
// version 1.0
// written June 2025 by Anon
// 3 of 3