UVA 10340

    xiaoxiao2021-04-02  37

    题目描述:点击打开链接

    /* 思路:输入一个子串,看主串能否组成子串。 所以子串一个一个字符看能不能从主串匹配便可。 */ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); while(cin.hasNext()) { String strA=cin.next(); String strB=cin.next(); int cnt=0; for(int i=0;i<strB.length();++i) if(cnt!=strA.length() && strA.charAt(cnt)==strB.charAt(i)) cnt++; if(strA.length()==cnt) System.out.println("Yes"); else System.out.println("No"); } } }

    转载请注明原文地址: https://ju.6miu.com/read-665759.html

    最新回复(0)