26
1
(Inspired by this challenge.)
Let's say we have a string ABBCBA
. We can say that there is a rise between A
and B
, for B
follows A
; we can say that there is a run between B
and B
, for nothing changes; and finally we can say there is a fall between C
and B
. We can draw a graph like this:
A B B C B A
Rising: o o
Continuing: o
Falling: o o
Without the labels, and minimizing whitespace:
o o
o
oo
This is the expected output for input ABBCBA
.
You may use any non-whitespace character to replace o
in the output. Further, each column may optionally have an extra space between them, like so:
o o
o
o o
The input will consist of at least three characters. The string will consist entirely of uppercase letters, but you may instead use lowercase letters.
Test cases
TEST CASE
LINE 1
LINE 2
LINE 3
HELLOWORLD
o oo o
o
o o oo
TESTCASE
oo o
o oo o
EXAMINATION
o o o o o
o o o o o
ZSILENTYOUTH
o ooo o
oo o o oo
ABC
oo
ABCBA
oo
oo
Could there be a space between each consecutive
o
s, or does the output have to be compact? – JungHwan Min – 2016-09-25T00:04:08.180@JHM Sure, that's fine. – Conor O'Brien – 2016-09-25T00:05:40.133
Also, does the output have to be a string, or does it only need to look similar to the example? – JungHwan Min – 2016-09-25T00:06:06.600
@JHM What do you ahve in mind? – Conor O'Brien – 2016-09-25T00:06:51.250
The code I have in mind generates a grid. – JungHwan Min – 2016-09-25T00:07:57.470
@JHM A grid? Could you give me an example? – Conor O'Brien – 2016-09-25T00:08:23.470
The output looks identical to the requirement, but copy/pasting it gives a list. – JungHwan Min – 2016-09-25T00:11:05.277
@Arnauld no, it is not. – Conor O'Brien – 2016-09-25T00:12:52.720
@JHM I only care about the output. – Conor O'Brien – 2016-09-25T00:13:06.057
May we output a list of three strings? – xnor – 2016-09-25T05:27:49.387
@xnor I suppose, yeah. – Conor O'Brien – 2016-09-25T05:29:53.597