#include <iostream>
#include <map>
#include <string>
// Custom comparator for case-insensitive string comparison
struct CaseInsensitiveCompare {
bool operator()(const std::string& a, const std::string& b) const {
return std::lexicographical_compare(
a.begin(), a.end(), b.begin(), b.end(),
[](char c1, char c2) { return std::tolower(c1) < std::tolower(c2); }
);
}
};
int main() {
std::map<std::string, int, CaseInsensitiveCompare> scores;
scores["Alice"] = 100;
scores["bob"] = 85;
scores["CHARLIE"] = 90;
// This will update "Alice" instead of creating a new entry
scores["aLiCe"] = 95;
for (const auto& pair : scores) {
std::cout << pair.first << ": " << pair.second << std::endl;
}
return 0;
}