-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheje1028.java
More file actions
33 lines (32 loc) · 1008 Bytes
/
eje1028.java
File metadata and controls
33 lines (32 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.util.Scanner;
public class eje1028
{
public static void main(String [] args){
Scanner lee = new Scanner(System.in);
while(lee.hasNextLine()){
String [] cad = lee.nextLine().split(" ");
String p1 = cad[0];
String p2 = cad[1];
if(p2.contains(p1)){
System.out.println("Yes");
}
else {
String s = "";
int ec2 = 0;
for(int i=0; i<p1.length(); i++){
for(int j = ec2; j<p2.length(); j++){
if(p1.charAt(i)==p2.charAt(j)){
s+= p2.charAt(j);
ec2 = j+1;
break;
}
}
}
if(s.equals(p1))
System.out.println("Yes");
else
System.out.println("No");
}
}
}
}