标签:
3 11 1001110110 101 110010010010001 1010 110100010101011
3 0 3
#include <iostream> #include <cstring> using namespace std; int main() { int T; char a[11]; char b[1001]; int i; int j; int count; int temp; int a_length; int b_length; cin >> T; while (T--) { cin >> a >> b; count = 0; a_length = strlen(a); b_length = strlen(b); for (i = 0;i < b_length-a_length+1;i++) { temp = i; for (j = 0;j < a_length;temp++,j++) { if (b[temp] != a[j]) { break; } } if (j >= a_length) { count++; } } cout << count << endl; } return 0; }
标签:
原文地址:http://www.cnblogs.com/zqxLonely/p/4913531.html