Code for the Advent of Code event
aoc
advent-of-code
1local nice_count = 0
2
3local input = io.open("input.txt", "r")
4
5for line in input:lines("l") do
6 local repeat_group = line:match("(..).*%1")
7 local repeat_between = line:match("(.).%1")
8
9 if repeat_group and repeat_between then nice_count = nice_count + 1 end
10end
11
12print(("%d strings are nice"):format(nice_count))
13
14input:close()