Climbing send log
EasyOnline Assessment
Summarise a climber's logbook: the hardest send and the number of sends in each grading system.
Each entry of log is a string "<grade> <result>". A gym has two grading systems, and grades are only ever compared within their own system:
- Rope routes use
5.5up to5.9, then5.10a,5.10b,5.10c,5.10d,5.11a, and so on up to5.15d. Grades from 5.10 up always carry a letteratod; lower grades never do. A higher number is harder, and for the same number a later letter is harder. So5.10ais harder than5.9. - Boulder problems use
VB(the easiest), thenV0,V1, up toV17. A larger number is harder, soV10is harder thanV2.
The result is one of send, flash, onsight (all three count as a send), or fell, bailed (not a send). Only sends count towards the hardest grade and the send count. The same grade may be logged many times and every send counts.
Input: log, a list of strings such as "5.10a send" or "V4 fell".
Output: a list [routeHardest, routeSends, boulderHardest, boulderSends]. A hardest grade is the exact grade text from the log, or "-" when that system has no sends (its send count is then 0).
Example 1
- Input:
- [["5.9 send","5.10a flash","5.11a fell","V3 send","5.10c onsight","V5 fell","VB send"]]
- Output:
- ["5.10c",3,"V3",2]
- Explanation
- Rope sends are
5.9,5.10aand5.10c;5.11awas a fall.5.10cis the hardest, because 5.10 comes after 5.9 even though the text5.9sorts later. Boulders:V3andVBwere sends,V5was a fall, soV3is the hardest. The result is["5.10c", 3, "V3", 2].
Example 2
- Input:
- [["V10 send","5.12a fell","V2 send","V0 flash","5.7 bailed"]]
- Output:
- ["-",0,"V10",3]
- Explanation
- No route entry was a send, so the route half is
"-"and0. The bouldersV10,V2andV0were all sends;V10is hardest, even though the textV2sorts afterV10.
Example 3
- Input:
- [[]]
- Output:
- ["-",0,"-",0]
- Explanation
- The log is empty: no sends in either system.
Constraints
0 <= log.length <= 500- every entry is a grade and a result separated by one space
- route grades run from
5.5to5.15d; boulder grades run fromVBtoV17