aboutsummaryrefslogtreecommitdiff
path: root/day04/part1
blob: 2d8bce6539dcf0b10bc08bc012c760f6c64e831a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env ruby

def valid(line)
  arr = line.split
  (0...arr.length).each do |i|
    (i+1...arr.length).each do |j|
      return false if arr[i] == arr[j]
    end
  end
  return true
end

input = $stdin.readlines.map(&:chomp)

puts input.select { |line|
  valid(line)
}.length