10340 - All in All

Problem Link

import java.util.*;
public class uva10340 {
public static void main(String [] args) {
Scanner scn = new Scanner(System.in);
while(scn.hasNext()) {
String s = scn.next();
String t = scn.next();
int b=0,c=0,y;
for(int x=0;x<s.length();x++) {
char a = s.charAt(x);
for(y=b;y<t.length();y++) {
if(a == t.charAt(y)) {
c++;
break; 
}
}
b=y+1;
}
if(c == s.length())
System.out.println("Yes");
else
System.out.println("No");
}
}
}

Share this

Related Posts

Previous
Next Post »

2 comments

comments
14 February 2016 at 09:44 delete

why it is wrong? can you clarify it?

Reply
avatar