Problem Directory: /home/bvanderz/cs140/Labs/bestName

Problem Description

Create a C++ program named bestName.cpp that solves the following problem. Standard input is going to be composed of lines of text, where each line contains a person's first name andlast name. We are going to define the "best" last name to be the last name that has the most different firstnames. If multiple last names have the same number of first names, then the "best" one is thelexicographically smallest.Your job is to write a program that prints out, in lexicographic order, the first names of all the people with the"best" last name. I want you to use sets and maps from the C++ Standard Template Library.

Sample input might be:

Brad VanderZanden
Joe Smith
Terry Smith
Joe Smith
Smiley VanderZanden
Nels VanderZanden
Cherry Smith
Michelle Smith
Nels VanderZanden
James VanderZanden
Sarah VanderZanden
Sue VanderZanden
Sally Smith
Smiley Smith
and sample output for the above input would be:
Cherry
Joe
Michelle
Sally
Smiley
Terry
because both Smith and VanderZanden have the same number of unique first names.

What To Do

  1. You will create a file named bestName.cpp to solve the above problem.
  2. Compile your file into an executable named "bestName".
  3. There are two input files named input1.txt and input2.txt. You can test your program by using these files as input to your program.
  4. There is an executable named "solution" that you can use to see the correct output. An example execution would be:
    	./solution < input1.txt
          
  5. You can run the "gradeall" script to see if your program passes the test cases.
  6. Upload bestName.cpp to the "AfterLecture Mar. 31: Best Name" submission link on Canvas when your program is passing the test cases.