Leave the coding aside first. You need a plan, everything needs a plan to start up with, almost. Devise the correct method to solving your problem, or so-called 'Algorithm'. Write it down using paper and pen. Describe the approach step by step using natural language. Sort out the logic, repeat until it makes sense. Once this is done. You get the so-called pseudo code describing the algorithm of solving your problem. Now then can you sit down and transform this pseudo code into a computer program using a any computer programming language.
For your question, the pseudo code may look like:
Step 1 Reverse the (original) string character by character.
Step 2 Scan through the (reversed) string character by character,
2.1 When a digit is found, reversed it.
Alternatively, you may start with step 2 on the original string followed by step 1.
Notice, two of the operations involving string reversal are similar, they are candidates for re-use. Take note of this in your coding.
To improve your code, ask yourself, do you need to reverse a single digit?
I will not provide code, but your can google for relevant methods in your programming language of choice that can perform the following operations:
1. Pattern matching (Regex).
2. String manipulation.
3. Looping construct.
Enjoy learning...