62
12
Oreoorererereoo
Given an input string that is similar to the word "oreo", give an ASCII representation of the cookie that is as wide as the input string (to ensure cookie stability).
Rules
- The input is lowercase, a non-empty string with no whitespace containing any combination of the strings "o" and "re", and containing only those strings.
- The string "o" represents the solid cookie, while the string "re" represents the filling.
- The output must be a stacked cookie that is as wide as the input string.
- The output may not be an array of strings
- The cookie must overlap the filling by one character on each side
- The characters used for the output don't have to match the output below (█ and ░), they just have to be different non-whitespace characters for the two parts of the cookie
- The whitespace padding on the left side of the filling is required, and any trailing whitespace is optional
Examples
Input: oreo
Output:
████
░░
████
Input: o
Output:
█
Input: re
Output: (two spaces)
Input: rere
Output:
░░
░░
Input: oreoorererereoo
Output:
███████████████
░░░░░░░░░░░░░
███████████████
███████████████
░░░░░░░░░░░░░
░░░░░░░░░░░░░
░░░░░░░░░░░░░
░░░░░░░░░░░░░
███████████████
███████████████
Since this is code golf the shortest answer wins, good luck :)
3"The whitespace padding on each side of the filling is required". Does this actually mean that there must be a space character at the end of each line of filling? If so why? As long as it works visually then what does this requirement add to the challenge? – ElPedro – 2019-01-06T00:23:33.343
@ ElPedro Good point, I modified the rules and @Dennis I edited the rules so the comments should be okay to clean up – GammaGames – 2019-01-07T03:22:45.197
@JonathanAllan Since it's printing "ascii-art" I removed that rule, it looks like I forgot to update the question. Should be updated now. – GammaGames – 2019-01-07T16:05:06.207
Awesome, thanks! – Jonathan Allan – 2019-01-07T16:18:12.050
@GammaGames, if whitespace on the right is not required anymore, I assume the output for test case
re
should be now acceptable as1 or 2 spaces
, not necessarily 2? – Kirill L. – 2019-01-10T08:24:08.743@KirillL. That would be correct, yes. When I originally designed it I accidentally didn't use general ascii rules, but I modified them as to be more flexible. – GammaGames – 2019-01-10T15:07:41.840