From 49a86bff1696ce19d2c7160eba4b5146cf426fd4 Mon Sep 17 00:00:00 2001 From: Jethro Stapelbroek Date: Tue, 17 Oct 2023 20:42:54 +0200 Subject: [PATCH] Conformity --- conformity.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 conformity.py diff --git a/conformity.py b/conformity.py new file mode 100644 index 0000000..9e95589 --- /dev/null +++ b/conformity.py @@ -0,0 +1,21 @@ +n = int(input()) + +combinations = {} +maxcombi = 0 +combinations[maxcombi] = 0 + +for _ in range(n): + combi = "".join(sorted(input().strip().split())) + if combi in combinations.keys(): + combinations[combi] += 1 + if combinations[maxcombi] < combinations[combi]: + maxcombi = combi + else: + combinations[combi] = 1 + +max_value = combinations[maxcombi] +most_popular = sum( + [max_value for key in combinations if combinations[key] == max_value] +) + +print(most_popular if most_popular > 0 else len(combinations.keys()) - 1)