aboutsummaryrefslogtreecommitdiff
path: root/day01/part1
blob: f230be379e869221999f8ab4aff126ba99419e8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env ruby

input = gets.chomp.chars.map(&:to_i)
l = input.length

sum = 0

(0...l).each do |i|
  sum += input[i] if input[i] == input[(i + 1) % l]
end

puts sum