wrote substring.rb