import java.io.IOException;
import java.io.FileReader;
import java.io.BufferedReader;
import java.util.Scanner;
class Main
{
public static final boolean DEBUG = false;
public static void main(String[] args) throws IOException
{
Scanner cin;
String T, P;
if (DEBUG) {
cin = new Scanner(new BufferedReader(new FileReader("d:\\OJ\\uva_in.txt")));
} else {
cin = new Scanner(System.in);
}
while (cin.hasNext()) {
T = cin.next();
P = cin.next();
int num = 0;
//System.out.println(T.length() - P.length());
for (int i = 0; i <= T.length() - P.length(); i++) {
if (T.substring(i, i + P.length()).compareTo(P) == 0) num++;
}
System.out.println(num);
}
}
}
题目1094:String Matching
最新推荐文章于 2021-01-21 16:32:45 发布