From 02f299af17747bb926cbc908bf1d366ed09fd61e Mon Sep 17 00:00:00 2001 From: Jake Charman Date: Tue, 6 Dec 2022 09:19:18 +0000 Subject: [PATCH] Completed day 6 --- 2022/Day-06/day01-1.py | 14 ++++++++++++++ 2022/Day-06/day01-2.py | 14 ++++++++++++++ 2022/Day-06/day06-1.py | 14 ++++++++++++++ 2022/Day-06/day06-2.py | 14 ++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 2022/Day-06/day01-1.py create mode 100644 2022/Day-06/day01-2.py create mode 100644 2022/Day-06/day06-1.py create mode 100644 2022/Day-06/day06-2.py diff --git a/2022/Day-06/day01-1.py b/2022/Day-06/day01-1.py new file mode 100644 index 0000000..92fa57f --- /dev/null +++ b/2022/Day-06/day01-1.py @@ -0,0 +1,14 @@ +#!/usr/bin/python3 + +input = open('input.txt', 'r').readline() + +i = 0 +different = [] +while(len(different) < 4): + if(input[i] not in different): + different.append(input[i]) + else: + different = [] + i += 1 + +print(i - 1) diff --git a/2022/Day-06/day01-2.py b/2022/Day-06/day01-2.py new file mode 100644 index 0000000..6afc774 --- /dev/null +++ b/2022/Day-06/day01-2.py @@ -0,0 +1,14 @@ +#!/usr/bin/python3 + +input = open('input.txt', 'r').readline() + +i = 0 +different = [] +while(len(different) < 13): + if(input[i] not in different): + different.append(input[i]) + else: + different = [] + i += 1 + +print(i - 1) diff --git a/2022/Day-06/day06-1.py b/2022/Day-06/day06-1.py new file mode 100644 index 0000000..92fa57f --- /dev/null +++ b/2022/Day-06/day06-1.py @@ -0,0 +1,14 @@ +#!/usr/bin/python3 + +input = open('input.txt', 'r').readline() + +i = 0 +different = [] +while(len(different) < 4): + if(input[i] not in different): + different.append(input[i]) + else: + different = [] + i += 1 + +print(i - 1) diff --git a/2022/Day-06/day06-2.py b/2022/Day-06/day06-2.py new file mode 100644 index 0000000..6afc774 --- /dev/null +++ b/2022/Day-06/day06-2.py @@ -0,0 +1,14 @@ +#!/usr/bin/python3 + +input = open('input.txt', 'r').readline() + +i = 0 +different = [] +while(len(different) < 13): + if(input[i] not in different): + different.append(input[i]) + else: + different = [] + i += 1 + +print(i - 1)