Sha256: 9b9dda9004803a209ce773e43c93840c7b39f09d15a4ea6321c84f3b63a9c269

Contents?: true

Size: 436 Bytes

Versions: 4

Compression:

Stored size: 436 Bytes

Contents

#
# https://adventofcode.com/2018/day/2 part 2
#
# Does not use any cem functions \o/

previous = ''
File.readlines("inputs/day2_input.txt").sort.each { |l|

  mismatch = 0
  s = ''
  if previous != ''
    l.split("").each_with_index { |c, i|
      if previous[i] != c 
        mismatch += 1 
      else
        s += c
      end      
    }  
  end
  
  if mismatch == 1
    puts s
  end
  
  previous = l
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cem-0.1.7 examples/aoc2018/day2_2.rb
cem-0.1.6 examples/aoc2018/day2_2.rb
cem-0.1.5 examples/aoc2018/day2_2.rb
cem-0.1.4 examples/aoc2018/day2_2.rb