Something went wrong. Try again.
Code for the Advent of Code event
aoc advent-of-code
Something went wrong. Try again.
436 B · 15 lines
Lua
at main
12345678910111213141516local nice_count = 0
local input = io.open("input.txt", "r")
for line in input:lines("l") do local _, vowels = line:gsub("[aeiou]", "%0") local repeated = line:match("(.)%1") local banned = line:match("ab") or line:match("cd") or line:match("pq") or line:match("xy")
if vowels >= 3 and repeated and not banned then nice_count = nice_count + 1 endend
print(("%d strings are nice"):format(nice_count))
input:close()