aboutsummaryrefslogtreecommitdiff
path: root/2017/04/puzzles.py
diff options
context:
space:
mode:
Diffstat (limited to '2017/04/puzzles.py')
-rw-r--r--2017/04/puzzles.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/2017/04/puzzles.py b/2017/04/puzzles.py
new file mode 100644
index 0000000..1cf6924
--- /dev/null
+++ b/2017/04/puzzles.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+
+
+def main() -> None:
+ with open("input", "r", encoding="utf-8") as f:
+ print(
+ sum(
+ map(
+ lambda p: len(p) == len(set(p)),
+ # START PART 1
+ map (
+ lambda l: l.split(), f.readlines()
+ ),
+ # END PART 1 START PART 2
+ map(
+ lambda l: list(map(lambda w: "".join(sorted(w)), l.split())), f.readlines()
+ ),
+ # END PART 2
+ )
+ )
+ )
+
+
+if __name__ == "__main__":
+ main()