Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- main(){
- char word[15],stat[256];
- int flag = 0,i,j,cnt=0;
- printf("statment pls.\n");
- gets(stat);
- printf("word pls.\n");
- scanf("%s",word);
- for (i=0;i<256;i++){
- flag =0;
- if (word[0]==stat[i]){
- flag =1;
- for(j=1;word[j]!=0;j++){
- if (word[j]!=stat[j+i]){flag=-1;break;}
- }
- }
- if (flag==1){
- cnt++;
- printf("occurence @ %d\n",i);
- }
- }
- printf("Total number of occurrences = %d \n",cnt);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement