#include <iostream>
#include <map>
#include <deque>
#include <string>
#include <algorithm>

int main()
{
    const std::string my_strings[] =
    {
        "thing1", "abcd", "accc", "super",
        "consider", "using", "the", "standard", "library",
        "it", "makes", "life", "a", "lot", "easier"
    };

    // http://w...content-available-to-author-only...s.com/reference/map/map/
    // http://w...content-available-to-author-only...s.com/reference/deque/deque/
    std::map< char, std::deque<std::string> > dict ;

    // add the strings to the dictionary in any order
    // http://w...content-available-to-author-only...p.com/C++11FAQ.html#for
    for( const std::string& str : my_strings )
        if( !str.empty() ) dict[ str[0] ].push_back(str) ;

    // http://w...content-available-to-author-only...p.com/C++11FAQ.html#auto
    for( auto& pair : dict ) // sort strings under each alphabet
    {
        auto& deque = pair.second ;
        // http://w...content-available-to-author-only...s.com/reference/algorithm/sort/
        std::sort( std::begin(deque), std::end(deque) ) ;
    }

    for( const auto& pair : dict ) // print out the contemts
    {
        std::cout << "key: '" << pair.first << "'  values: [ " ;
        for( const std::string& str : pair.second )
            std::cout << "'" << str << "' " ;
        std::cout << "]\n" ;
    }
}