#K70867. Unique Ingredient Combinations
Unique Ingredient Combinations
Unique Ingredient Combinations
You are given n ingredient combinations. Each combination is represented as a string containing multiple ingredients separated by commas. Each ingredient is in the format \(\texttt{ingredient_name quantity}\).
The order of ingredients in a combination does not matter. For example, the combinations "sugar 2,flour 3" and "flour 3,sugar 2" are considered identical.
Your task is to count the number of unique ingredient combinations.
Example: If we have 5 combinations:
5 sugar 2,flour 3 flour 3,sugar 2 butter 1,eggs 3 eggs 3,butter 1 milk 2,sugar 1
Then, the answer is \(3\) because there are three unique combinations.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer \(n\) — the number of ingredient combinations.
- The next \(n\) lines each contain a string representing an ingredient combination. Each combination contains one or more ingredients separated by commas. Each ingredient is given in the format "ingredient_name quantity".
outputFormat
Output to standard output (stdout) a single integer representing the number of unique ingredient combinations.
## sample5
sugar 2,flour 3
flour 3,sugar 2
butter 1,eggs 3
eggs 3,butter 1
milk 2,sugar 1
3