At position : If is '': (can't decode) Otherwise: (take one digit) If forms -: (also take two digits) The total is the sum of both valid choices.
The transition is the core of any DP solution. It defines how the answer for the current state depends on answers for previous states. Getting the transition right is often the hardest and most rewarding part.