Meeta’s uncle came to visit her in the summer vaccations they brought a lot of chocolates for her but for each chocolate they asked her to give answer to his question. He would give a number as a string, for which Meeta has to find the number of substrings (or contiguous subsequences) of the given string which recursively add up to 9.

The problem is to find out the number of substrings (or contiguous subsequences) of the given string which recursively add up to 9.