#include #include int contain(char str_long[],char str_short[]) { int index=0,index2=0; int counter=0,counter2=0; while(str_long[index2]!='/0') { if (str_long[index2]==str_short[index]) { if (str_long[index2]==str_short[index]) { index++; index2++; counter++; } else counter=0; if (counter==strlen(str_short)) { counter2++; index=0; } continue; } else{ index++; index2++; if (str_short[index]=='/0') index=0; } } return counter2; } void main() { char str_short1[5]={"abc"}; char str_long1[20]={"abcweryttaretabc"}; printf("%d",contain(str_long1,str_short1)); }