Table Math
You should which side of a table is the oldest, from ASCII art. I think the best way to explain is with an example, so here is one.
You have a table, made out of +
, |
, and -
. Here is one.
+--+
| |
| |
| |
+--+
It will alway be a rectangle, just not always square (but it can be square). There will also be people around the table, marked by the letters A-Z. There will never be too many people on a side, or less than one. Just to make it harder, the people will not always be in order, like this:
P
+--+
I| |
O| |Q
| |J
+--+
U
There will never be anybody next to a plus sign(+
). You will be given input on how old each member is, separated by a newline, from the first letter that appears alphabetically (I in this example) to the last letter that appears alphabetically (U in this example), like this:
20
8
31
56
6
56
As seen here, ties are allowed. You should then output the sides with their ages separated with a space, in order from oldest to youngest, like this.
Top 56
Bottom 56
Left 51
Right 14
Note that for everything in this challenge, you can choose the capitalization of the letters, even the input. The winner is the submission with the shortest code.