Condition to check if the previous digit is equal to " * "
else if ( first == ' ' ) { if ( second == ' ' ) { dp [ i ] += 15 * dp [ i - 2 ] ; } else if ( second <= ' ' ) { dp [ i ] += 2 * dp [ i - 2 ] ; } else { dp [ i ] += dp [ i - 2 ] ; } } } return dp [ n ] ; }