Generate a wave pattern based on a string
Given a string, generate a "wave" pattern based on the sequence of characters. Each character in the string will create a peak in the wave, rising and falling around the character. The height of the peak should be equal to the amount of characters in the string. The wave should alternate between peaks and valleys.
For example, given the string hello
, the wave pattern would look like this:
h e l l o
h h e e l l l l o o
h h e e l l l l o o
h h e e l l l l o o
h h e l l o
For spy
, the wave pattern would look like this:
s p y
s s p p y y
s s p y
Constraints: the input is a single word string with between 3 and 100 characters.
Note: When comparing your output with the expected one, the trailing spaces on each line are ignored.
# | Size | % | Users |
---|---|---|---|
#1 | 145 c. | Top 17% | |
#2 | 148 c. | Top 33% | |
#3 | 151 c. | Top 50% | |
#4 | 181 c. | Top 67% | |
#5 | 186 c. | Top 83% | |
#6 | 192 c. | Top 100% |