poj1936

package easy;


import java.io.BufferedInputStream;
import java.util.Scanner;

/**
 *poj1936 easy
 * @author NC
 */
public class Poj1936 {

    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedInputStream(System.in));
        while (scan.hasNext()) {
            String[] ss = scan.nextLine().trim().split(" ");
            char[] sa = ss[0].toCharArray();
            char[] sb = ss[1].toCharArray();
            int j = 0, flag = 0;
            for (int i = 0; i < sa.length; i++) {
                for (; j < sb.length; j++) {
                    if (sa[i] == sb[j]) {
                        flag++;
                        j++;
                        break;
                    }
                }
            }
            if (flag == sa.length) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }

    }
}

你可能感兴趣的:(java,J#)