Java program for the above approach
import java . io . * ; class GFG { static int M = 1000000007 ; static int waysOfDecoding ( String s ) { long first = 1 , second = s . charAt ( 0 ) == ' * ' ? 9 : s . charAt ( 0 ) == '0' ? 0 : 1 ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) { long temp = second ;