Skip to content

Instantly share code, notes, and snippets.

@tbilous
Created July 12, 2019 05:55
Show Gist options
  • Save tbilous/83eafafa531df61edf3e813a74a3c946 to your computer and use it in GitHub Desktop.
Save tbilous/83eafafa531df61edf3e813a74a3c946 to your computer and use it in GitHub Desktop.
Part 1 Task 2 (Ver.1)
#!/usr/bin/env ruby
# example: ruby task_p1_t2_v1.rb 'To be or not to be that is the question' 5
v1, v2 = ARGV
puts v1.scan(/.{1,#{v2}}\b|.{1,#{v2}}/).each(&:lstrip!).join("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment