Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main(){
- char src[]="xabaacbaxabb";
- char dest[]="ab";
- int match=0;
- for(int i=0;i<sizeof(src)-1;i++){
- for(int j=0,k=i;j<sizeof(dest)-1;j++,k++){
- if(dest[j]!=src[k]) break;
- if((j+1)==strlen(dest)) match++;
- }
- }
- cout << "talalt: " << match << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement