// Exercise description:
//   Write a program that takes in multiple command line arguments as strings,
// uses an unordered_multimap to map from string length to strings, and prints
// out the contents of the map, i.e. the key and value.
//
// Sample Solution:

#include <iostream>
#include <unordered_map>
#include <cstring>

using namespace std;

int main(int argc, char **argv) {
  unordered_multimap <int, string> map;

  // Map each string's length to the string itself
  for (int i = 1; i < argc; i++) {
    int len = strlen(argv[i]);
    string word(argv[i]);
    map.insert(pair<int, string>(len, word));        
  }

  // Print out the map keys and values
  for (auto& it: map)
    cout << it.first << ": " << it.second << endl; 
}