fork(1) download
#include 
#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;
 

int main()
{
 
  std::map > m;  

  m["AA"] = {1, 2, 3, 1, 2, 1, 2, 3};
  m["BB"] = {2, 3, 4, 1, 2, 3, 4, 5, 5 };  
  m["CC"] = {2, 3, 4, 1, 2, 3, 4, 5};
  
  size_t size = 0;
  for (auto item = m.begin(); item != m.end(); ++item)
  {
    std::cout << item->first << '\t';
    if (size < item->second.size())
    {
      size = item->second.size();
    }
  }

  std::cout << std::endl;

  for (size_t i = 0; i< size; i++)
  {
    for (auto item = m.begin(); item != m.end(); ++item)
    {
      if (i < item->second.size())
      {
        std::cout << item->second.at(i) << '\t';
      }
    }
    std::cout << std::endl;
  }
  
    return 0;
}
Success #stdin #stdout 0s 3024KB
stdin
Standard input is empty
stdout
AA	BB	CC	
1	2	2	
2	3	3	
3	4	4	
1	1	1	
2	2	2	
1	3	3	
2	4	4	
3	5	5	
5