Title Description
Two strings by the same letter (not number of letters, etc.), compared with the word formation. Such as "ab" and "ababbb" "abbbc" and "abcc"
Entry
The first line has an integer N denotes N sets of test data.
Then there are N rows, and each row has two strings (all lowercase letters and a length less than 10000).
Then there are N rows, and each row has two strings (all lowercase letters and a length less than 10000).
Export
N output lines. If the two strings is the same word-building output "Yes", otherwise a "No".
Sample input
2
ab ababbb
abc aac
Sample Output
Yes
No
import java.util.*; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); //TODO String s1[]=new String[1000]; String s2[]=new String[1000]; String s3[]=new String[1000]; int n; n=cin.nextInt(); for (int i = 0; i < n; i++) { s1[i]=cin.next(); s2[i]=cin.next(); } for (int i = 0; i < n; i++) { if (s2[i].contains(s1[i])) s3[i]="Yes"; else s3[i]="No"; } for (int i = 0; i <n ; i++) { System.out.println(s3[i]); } cin.close(); } }