#include <map>
#include <string>
#include <iostream>

int main() {
    std::map<std::string, std::string> myMap{
        {"John", "AA"}, {"Mary", "BBB"}, {"Mother", "A"}, {"Marlon", "C"}, {"Marla", "D"}
    };
    std::string prefix("Marl");

    std::cout << "First match:" << std::endl;

    auto it = myMap.lower_bound(prefix);
    if (it != std::end(myMap) && it->first.compare(0, prefix.size(), prefix) == 0)
        std::cout << it->first << ": " << it->second << std::endl;

    std::cout << std::endl << "All matches:" << std::endl;

    for (it = myMap.lower_bound(prefix); it != std::end(myMap) && it->first.compare(0, prefix.size(), prefix) == 0; ++it)
        std::cout << it->first << ": " << it->second << std::endl;

	return 0;
}