思路
利用正则表达式, 在子序列里插入".*"
import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); String seq = sc.next(); String[] split = seq.split(""); String deal = String.join(".*", split); Pattern p = Pattern.compile(deal); Matcher mat = p.matcher(s); System.out.println(mat.find()?"Yes":"No"); } }