Inspired by Draw a timeline.
Given a timeline of events, output the date for each event.
A timeline will be given in the form
2000
--AF-C-------E--D---B--
Where the first line shows a known point in time. The known year is always the character below the first digit of the known year
You may assume:
- On the timeline itself, each character represents one year.
- There will always be at least one event
- The events don't have to be in order
- You may assume every character in the range between
A
and the furthest character is present - There will be at most 26 events
- The known point will not have any padding to the right
- There can be negative numbers in both the known point and the output
- You will not have to handle numbers bigger than 2^32
- You will not have to handle ranges bigger than 2^8
- You can take input as lowercase letters instead of uppercase
You should write a program that takes a timeline in this form and outputs the key dates in order (A, B, C, D...)
You may output in a convenient form but you must take input in the format given.
Test cases:
2000
--AF-C-------E--D---B--
[1998, 2016, 2001, 2012, 2009, 1999]
10
--C-AB--D
[9, 10, 7, 13]
0
--ABCDEFG--
[-3, -2, -1, 0, 1, 2, 3]
5
--ABCDEFG--
[-3, -2, -1, 0, 1, 2, 3]