Import Java.util.Scanner;
public class Q1168 {
public static void Main (string[] args) {
Scanner Scanner = new Scanner (system.in);
String shtstr = Scanner.nextline ();
Char[] C = Shtstr.tochararray ();
while (Scanner.hasnext ()) {
String target = Scanner.nextline ();
String[] s = Target.split ("");
String a = "";
for (int i=0; i<s.length; i++) {
A = A.concat (S[i]);
}
char[] t = A.tochararray ();
for (int i=0; i<t.length; i++) {
J record the length that has been matched (compared to c.length), flag=0 always matches
Int j = 0, flag = 0;
int sig = 0;//record How many characters are matched consecutively
while (true) {
if ((int) c[j]>=65 && (int) c[j]<=90) {
Matches the characters in the short string to A~z
if ((int) T[i+sig] = = (int) C[j] | | (int) T[i] = = (int) c[j]+32) {
Successful match
Flag = 0;
sig++;
j + +;
if (sig = = C.length) {
i = i + sig-1;
Break
}
else if (I+sig = = t.length) {
Not finished, but the character array has been matched to the last one
for (int x=i; x<i+sig; x + +) {
System.out.print (T[x]);
}
i = t.length-1;
Break
}
Elsecontinue;
}
else{
No match succeeded
flag = 1;
for (int x=i; x<=i+sig; x + +) {
System.out.print (T[x]);
}
i = i + sig;
Break
}
}
else if ((int) c[j]>=48 && (int) c[j]<=57) {
Matches the characters in the short string to 0~9
if ((int) T[i+sig] = = (int) c[j]) {
Successful match
Flag = 0;
sig++;
j + +;
if (sig = = C.length) {
i = i + sig-1;
Break
}
else if (I+sig = = t.length) {
Not finished, but the character array has been matched to the last one
for (int x=i; x<i+sig; x + +) {
System.out.print (T[x]);
}
i = t.length-1;
Break
}
Elsecontinue;
}
else{
No match succeeded
flag = 1;
for (int x=i; x<=i+sig; x + +) {
System.out.print (T[x]);
}
i = i + sig;
Break
}
}
else if ((int) c[j]>=97 && (int) c[j]<=122) {
Matches the characters in the short string to A~z
if ((int) T[i+sig] = = (int) C[j] | | (int) T[i+sig] = = (int) c[j]-32) {
Successful match
Flag = 0;
sig++;
j + +;
if (sig = = C.length) {
i = i + sig-1;
Break
}
else if (I+sig = = t.length) {
Not finished, but the character array has been matched to the last one
for (int x=i; x<i+sig; x + +) {
System.out.print (T[x]);
}
i = t.length-1;
Break
}
Elsecontinue;
}
else{
No match succeeded
flag = 1;
for (int x=i; x<=i+sig; x + +) {
System.out.print (T[x]);
}
i = i + sig;
Break
}
}
else {
Match to a different character
if ((int) T[i+sig] = = (int) c[j]) {
Successful match
Flag = 0;
sig++;
j + +;
if (sig = = C.length) {
i = i + sig-1;
Break
}
else if (I+sig = = t.length) {
Not finished, but the character array has been matched to the last one
for (int x=i; x<i+sig; x + +) {
System.out.print (T[x]);
}
i = t.length-1;
Break
}
Elsecontinue;
}
else{
No match succeeded
flag = 1;
for (int x=i; x<=i+sig; x + +) {
System.out.print (T[x]);
}
i = i + sig;
Break
}
}
}
}
System.out.println ();
}
}
}
Nine degrees oj--q1168