Time Limit: 1 Second Memory Limit: 32768 KB
The pizza parlor you are calling offers the following pizza toppings; you can include or omit any of them in a pizza:
B Black Olives
C Canadian Bacon
D Diced Garlic
E Extra Cheese
F Fresh Broccoli
G Green Peppers
I Italian Sausage
J Jalapeno Peppers
L Lean Ground Beef
N Nonfat Feta Cheese
Your friends provide you with a line of text that describes their pizza preferences. For example, the line
reveals that someone will accept a pizza with onion, or without ham, or with pepperoni, and the line
indicates that someone else will accept a pizza that omits extra cheese, or Italian sausage, or diced garlic, or that includes anchovies or jalapenos.
The input consists of a series of pizza constraints.
A pizza constraint is a list of 1 to 16 topping constraint lists each on a line by itself followed by a period on a line by itself.
A topping constraint list is a series of topping requests terminated by a single semicolon.
An topping request is a sign character (+/-) and then an uppercase letter from A to P.
For each pizza constraint, provide a description of a pizza that satisfies it. A description is the string "Toppings:" and then a series of letters, in alphabetical order, listing the toppings on the pizza. So, a pizza with onion, anchovies, fresh broccoli and Canadian bacon would be described by:
If no combination toppings can be found which satisfies at least one request of every person, your program should print the string
"No pizza can satisfy these requests." on a line by itself starting in column 1.
+A+B+C+D-E-F-G-H; -A-B+C+D-E-F+G+H; -A+B-C+D-E+F-G+H; . +A+B+C+D; +E+F+F+H; +A+B-G; +O+J-F; +H+I+C; +P; +O+M+L; +M-L+P; . +A+B+C+D; +E+F+F+H; +A+B-G; +P-O; +O+J-F; +H+I+C; +P; +O; +O+M+L; -O-P; +M-L+P; .
Toppings: Toppings: CELP No pizza can satisfy these requests.Submit
Source: South Central USA 1997