就是动态规划正则表达式匹配
AC代码
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			String s = sc.next();
			String p = sc.next();
			boolean[][] dp = new boolean[s.length() + 1][p.length() + 1];
			dp[0][0] = true;
			for (int i = 1; i < dp[0].length; i ++) {
				if(p.charAt(i - 1) == '*') dp[0][i] = dp[0][i - 1];
			}
			for (int i = 1; i < dp.length; i ++) {
				for (int j = 1; j < dp[0].length; j ++) {
					if(s.charAt(i - 1) == p.charAt(j - 1) || p.charAt(j - 1) == '?') dp[i][j] = dp[i - 1][j - 1];
					else if(p.charAt(j - 1) == '*') dp[i][j] = dp[i - 1][j] || dp[i][j - 1];
				}
			}
			if(dp[s.length()][p.length()]) System.out.println(1);
			else System.out.println(0);
		}
	}
}