Menu
CoddyTech

Recap: Repeated Codes

Lesson 20 of 48 in Coddy's Ruby for Python Developers course.

challenge icon

Challenge

Easy

Input is words. Return only words occurring at least twice, once each in alphabetical order, separated by spaces. Return none when no words repeat.

Return text from solve(input) without printing. The locked driver prints the returned text with one final newline and checks required public APIs independently.

Your code goes in exercise.rb. main.rb holds the supplied input/output code and cannot be edited.

Try it yourself

require_relative 'exercise'
def check(value)
  raise 'Public API check failed' unless value
end

puts solve(STDIN.read)

All lessons in Ruby for Python Developers

Practice on your own: Online Ruby compiler