- require 'set'
- @input = File.read("6.input").split("\n")
- def part(window_size)
- @input[0].chars.each_with_index do |c, i|
- chunk = @input[0].chars[(i..i+(window_size-1))]
- if Set.new(chunk).length == window_size then
- puts i + window_size
- break
- end
- end
- end
- part(4)
- part(14)
|