You can open a file stream and have it read in one character at a time adding each character to a string until you hit a comma. Save 3 words at a time and then re-arrange them into whatever order you need. Then loop that until end of file.
#include <iostream>
#include <fstream>
#include <string>
int main()
{
//create an ifstream object with the file you want to use for input
//create a collection to hold data of type DNB
//create a collection to hold data of type Swed
//if you don't know all the types beforehand, make a collection that
// will hold collections (I'd recommend std::vector for all these collections)
//while there are lines left to read in the file
//read a line
//parse line into three strings based on where the commas are
//based on the second string, determine which collection to put
// the other two strings combined
//end while
//output your collections
return 0;
}