Compute max-weight independent set in path [1,4,5,4] via DP

Given a path whose vertex weights are listed from left to right, return the maximum total weight of an independent set. An independent set cannot contain adjacent vertices. For the motivating path [1,4,5,4], the optimum is 8, using the vertices at zero-based indices 1 and 3.

Examples
Input: "1,4,5,4"
Output: 8
Hints

Compute max-weight independent set in path [1,4,5,4] via DP

Given a path whose vertex weights are listed from left to right, return the maximum total weight of an independent set. An independent set cannot contain adjacent vertices. For the motivating path `[1,4,5,4]`, the optimum is `8`, using the vertices at zero-based indices `1` and `3`.