Ready Set ...
Problem Statement
You are to write a program which reads 2 series of letters from a line, place
place them each into a set, and display either the intersection or union of the
two sets.
Input Specification
The file SETS.IN will contain lines consisting of two groups of letters
and an operator.
All letters will be in uppercase (A-Z) and the two groups of letters
will be separated by a single space. After the second set of letters will
be either the symbol + (for union) or * (for intersection). Each group of
letters will contain at least one letter. There is no special marker for the
termination of this file.
Output Specification
In the output file SETS.OUT, all sets should be enclosed in the
set brackets { and }. Sets should contain the letters that are members of
that set in alphabetic order, with a comma between elements. Each line
should be in the form:
SETA operator SETB = NEWSET
Sample Input
ABC ABD *
ABC ABD +
AB CD *
Sample Output
{A,B,C} * {A,B,D} = {A,B}
{A,B,C} + {A,B,D} = {A,B,C,D}
{A,B} * {C,D} = {}
This is a modified version of a practice problem from 1993.