Try it online! Or see the test-suite test-suite.
Try it online! Or see the test-suite.
Try it online! Or see the test-suite.
Jelly, 26 bytes
".ɓœṡnŒs$Œg§ḟ0ドル%5Ḍœrƭ0ドルj9t
A full program that accepts a string and prints the Rockstar poetic number literal.
Try it online! Or see the test-suite.
How?
".ɓœṡnŒs$Œg§ḟ0ドル%5Ḍœrƭ0ドルj9t - Main Link: list of characters, Poem
".ɓ - start a new chain f(Poem, Dot='.')
œṡ - split Poem at the first Dot
nŒs$ - not equal swapped-case? (vectorises)
Œg - group runs of equal elements
(only vectorises at depth 1)
§ - sums
ḟ0ドル - filter zeros from each
%5 - mod ten
€ - for each:
ƭ - alternate between:
Ḍ - 1) convert from decimal
-> integer part as an integer
œr 0 - 2) trim zeros from right
-> decimal part as a digit list
j9 - join with a Dot
t - trim any Dots from either side
(removes a potential trailing dot)
- implicit, smashing print