Description
Solutions
Road Trip (Analyst Program :P
🔥 FULLTIME

You've decided to make a road trip across the country in a straight line. You have chosen the direction you'd like to travel and made a list of cities in that direction that have gas stations to stop at and fill up your tank. To make sure that this route is viable, you need to know the distances between the adjacent cities in order to be able to travel this distance on a single tank of gasoline. (No one likes running out of gas.) but you only know distances to each city from your starting point.

Input:

Your program should read lines from standard input. Each line contains the list of cities and distances to them, comma-delimited, from the starting point of your trip. You start your trip at point 0. The cities with their distances are separated by semicolon.

Output:

Print out the distance from the starting point to the nearest city, and the distances between two nearest cities separated by comma, in order they appear on the route.

˚𖤣 𖥧‧⚘ ❀༉˚Credit to chizzy_elect 🌷

Example 1:

Input:  input = "Rkbs, 5453; Wdqiz, 1245; Rwds, 3890; Ujma, 5589; Tbzmo, 1303;"
Output: "1245, 58, 2587, 1563, 136"
Explanation:
Will add once find reference :P
Constraints:
    🍑🍑
Thumbnail 0
Testcase

Result
Case 1

input:

output: