After several years of suffering at the whim of A.J. Burdee (a.k.a "the Tyrant"), Ralph and Wanda began commiserating with each other. And, well, after a time, one thing led to another and finally fate took a hand. They found they were made for each other and decided to get married. As a first step, they decided to get to know each other's families. But this wouldn't be easy because both Ralph and Wanda come from rather large families.
Ralph and Wanda have made a file of their brothers and sisters, their wives and husbands, and their children. The list is in no particular order. You are to write a program to print Ralph's and Wanda's relatives in alphabetical order and you must use a linked list to hold the names in order. The file is 310FAMILY.COMPSCI and has two kinds o~ records with the following formats:
Lead record format
Column 1 R or W to indicate relative of Ralph or Wanda
Columns 2-11 Sibling name - name of brother or sister
Columns 12-23 Spouse name - name of a brother's wife of sister's husband
Child record format
Columns 2-11 Child's name - the child's parents are on the last lead record.
The list you create for Ralph or Wanda's relative might look like this:
The sibling nodes should be kept in alphabetical order. The children beneath a sibling node should also be in alphabetical order. Ralph and Wanda together have no more than 15 siblings. The total number of children is less than 30. A suggested format for the output follows:
Wanda's relatives
Sibling Spouse
Child
Child
Sibling Spouse
Sibling Spouse
Child
Child
Child
Child
etc.
Ralph's relatives
Sibling Spouse
Sibling None
Sibling Spouse
Child
Child
etc.
Your program should allow for couples that have no children, for unmarried siblings and for the repeated occurrence of a lead record.