@deeptigp I agree with you that this could be solved in a similar way to word break problem. In my solution above, we need to call the recursive function twice (once for left and once for right substrings), which is the main difference with the word break problem. The reason is that as we segment the given string into two parts we cannot immediately tell what number a segment represents. Therefore, we need to recursively solve each subproblem. Let me know if you agree. I assume that if there is a solution, it must be unique. Below function could be optimized via memoization, but I left it out for brevity.

```
def reversecount(s):
if not s: return ''
if '0' in s: return ''
if len(s) == 1: return ''
if len(s) == 2:
return s[1]*int(s[0])
if len(3) == 3:
return s[2]*int(s[:2])
n = len(s)
for i in xrange(2,n-1): ## go thru each possible segment
left = reversecount(s[:i]) ## check if the left substring could produce a valid number
right = reversecount(s[i:]) ## check if the right substring could produce a valid number
## if both substrings produce a valid number, then we found the original number
if left and right:
return left + right
return ''
```