Guest User

asdasdsads.java

a guest
Jul 15th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Main{
  4.    
  5.     public static void main(String args[]){
  6.         Scanner tc = new Scanner(System.in);
  7.         String p,s,t;
  8.         String[] sa;
  9.         while(tc.hasNextLine()){
  10.             p = tc.nextLine(); sa = p.split(" ");
  11.             s = sa[0]; t = sa[1];
  12.             int j=0,i=0;
  13.             while(i<t.length() && j<s.length()){
  14.                 if(t.charAt(i)==s.charAt(j)){ i++; j++; }
  15.                 else i++;
  16.             }
  17.             if(j==s.length()) System.out.println("Yes");
  18.             else          System.out.println("No");
  19.         }
  20.     }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment