aoc-2020-zig

Advent of Code 2020 Solutions in Zig
git clone https://git.sinitax.com/sinitax/aoc-2020-zig
Log | Files | Refs | README | sfeed.txt

part1 (1951B)


      1--- Day 6: Custom Customs ---
      2
      3As your flight approaches the regional airport where you'll switch to a much larger plane, customs
      4declaration forms are distributed to the passengers.
      5
      6The form asks a series of 26 yes-or-no questions marked a through z. All you need to do is identify
      7the questions for which anyone in your group answers "yes". Since your group is just
      8you, this doesn't take very long.
      9
     10However, the person sitting next to you seems to be experiencing a language barrier and asks if you
     11can help. For each of the people in their group, you write down the questions for which they answer
     12"yes", one per line. For example:
     13
     14abcx abcy abcz
     15
     16In this group, there are 6 questions to which anyone answered "yes": a, b, c, x, y, and
     17z. (Duplicate answers to the same question don't count extra; each question counts at most once.)
     18
     19Another group asks for your help, then another, and eventually you've collected answers from every
     20group on the plane (your puzzle input). Each group's answers are separated by a blank line, and
     21within each group, each person's answers are on a single line. For example:
     22
     23abc
     24
     25a b c
     26
     27ab ac
     28
     29a a a a
     30
     31b
     32
     33This list represents answers from five groups:
     34
     35- The first group contains one person who answered "yes" to 3 questions: a, b, and c. -
     36The second group contains three people; combined, they answered "yes" to 3 questions:
     37a, b, and c. - The third group contains two people; combined, they answered "yes" to 3
     38questions: a, b, and c. - The fourth group contains four people; combined, they answered "yes" to
     39only 1 question, a. - The last group contains one person who answered "yes" to only
     401 question, b.
     41
     42In this example, the sum of these counts is 3 + 3 + 3 + 1 + 1 = 11.
     43
     44For each group, count the number of questions to which anyone answered "yes". What is the
     45sum of those counts?
     46
     47