Created
May 14, 2025 01:51
-
-
Save ParadoxV5/7d13ea8b5e2e6221b5eb737c153136fd to your computer and use it in GitHub Desktop.
Sow and Tell – Ruby Discord Mother’s Day 2025 challenge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts$*[0].gsub(/(.)\1*/){'_🌷🌼🪻'[it.size]+$1} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This extends the language of flowers beyond 1–3 just to be ridiculous. 😁 | |
FLOWER = Hash.new(capacity: 3) do|h, n| #$ Integer, String | |
h[n] = (957*n*n - 2866*n + 129708).chr(Encoding::UTF_8) | |
end # { 1=>'🌷', 2=>'🌼', 3=>'🪻' } | |
ARGV.each do|input| | |
puts input.gsub(/(.)\1*/) { "#{FLOWER[it.size]}#{Regexp.last_match(1)}" } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment