B. War of the Corporations



time limit per test



memory limit per test



input



output


A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000.

This new device is equipped with specially designed artificial intelligence (AI). Employees of Pineapple did their best to postpone the release of Lastus 3000 as long as possible. Finally, they found out, that the name of the new artificial intelligence is similar to the name of the phone, that Pineapple released 200 years ago. As all rights on its name belong to Pineapple, they stand on changing the name of Gogol's artificial intelligence.

#". As this operation is pretty expensive, you should find the minimum number of characters to replace with "#", such that the name of AI doesn't contain the name of the phone as a substring.

Substring is a continuous subsequence of a string.


Input



100 000 characters. Second line contains the name of the phone released by Pineapple 200 years ago, its length doesn't exceed 30. Both string are non-empty and consist of only small English letters.


Output



#" in order to obtain that the name of the phone doesn't occur in the name of AI as a substring.


Sample test(s)



input



intellect tell



output



1



input



google apple



output



0



input



sirisiri sir



output



2


Note



读错题目了,怎么交都是WA。。



大体题意:



给你两个字符串A,B,问A中可以最少改几个字母使得A中不包含B,其实就是数A中有几个B。





思路:



建立一个char数组读,暴力扫描即可!





#include<bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
const int maxt = 100 + 10;
char str1[maxn],str2[maxt];
int main()
{
    int len1 = strlen(gets(str1));
    int len2 = strlen(gets(str2));
    int sum = 0,i,j;
    for (i = 0; i < len1; ++i){
        if(str1[i] == str2[0]){
            bool ok = true;
            for (j = 0; j < len2; ++j){
                if (str1[i+j] != str2[j]){ok=false;break;}
            }
            if (ok){
                ++sum;
                i+=len2-1;
            }
        }
    }
    cout << sum << endl;
    return 0;
}