string format(const string &name){
size_t first = name.find(" "); // sets size of first name
size_t middle = name.find(" ",first+1); //sets size of middle name
size_t last = name.find(middle+1); // sets size of last name
the input is a string that contains a first middle and last name. I want to reorder the string to print out Last, First, Middle!
For some reason my code prints out last, first, middle last?? I do not see why it is doing this because I set the substr's length, name.substr(first+1,middle) ,to the size of the middle name.