#include <iostream>
#include <set>
#include <string>

typedef  std::set<std::pair<std::string, std::string> > ssset;

ssset::iterator get_key(ssset& s, std::string key)
{
  ssset::iterator it = s.lower_bound(std::make_pair(key, ""));
  if (it != s.end() && it->first == key) return it;
  return s.end();   
}

ssset::const_iterator get_key(const ssset& s, std::string key)
{
  ssset::const_iterator it = s.lower_bound(std::make_pair(key, ""));
  if (it != s.end() && it->first == key) return it;
  return s.end();   
}

void insert(ssset& s, std::string key, std::string value)
{
   s.insert(std::make_pair(key, value));
}

int main() {
   ssset s;
   insert(s, "abc", "def");
   insert(s, "def", "def");
   insert(s, "abc", "ghi");
   insert(s, "abc", "ghi");
   insert(s, "abc", "abc");
    
   std::cout << "abc" << std::endl;
   for (ssset::iterator it = get_key(s, "abc"); it != s.end() && it->first == "abc"; ++it)
     std::cout << it->first << "->" << it->second << std::endl;

   std::cout << "def" << std::endl;
   for (ssset::iterator it = get_key(s, "def"); it != s.end() && it->first == "def"; ++it)
     std::cout << it->first << "->" << it->second << std::endl;

   std::cout << "ghi" << std::endl;
   for (ssset::iterator it = get_key(s, "ghi"); it != s.end() && it->first == "ghi"; ++it)
     std::cout << it->first << "->" << it->second << std::endl;

   std::cout << "----- ALL ----" << std::endl;
   for (ssset::iterator it = s.begin(); it != s.end(); ++it)
     std::cout << it->first << "->" << it->second << std::endl;
 
}