Add solution to encoder.rb and decoder.rb
Fix decoder.rb