Given daily prices, you may buy and sell as many times as you like (holding at most one share at a time; selling and re-buying the same day is allowed). Return the maximum total profit.
Input: one line of space-separated prices. Output: the maximum profit.
7 1 5 3 6 4
7
Buy 1 → sell 5 (+4), buy 3 → sell 6 (+3).
1 2 3 4 5
4
One long hold — or every daily rise; same total.
7 6 4 3 1
0
Run your code against the sample tests, or Submit to run the full suite.