String self-similarity
You re-calculate string length every iteration of every loop:

    for(i =0;i&lt;strlen(strMain);i++){
        for(j =0;j+i&lt;strlen(strMain);j++){


It does not look like the string changes length. So calculate it once.

    size_t  size = strlen(strMain);
    for(i =0; i &lt; size; i++){
        for(j =0; j+i &lt; size; j++){


Or don't even calculate it at all. The string is terminated when you reach the '\0' character so just look for that

    for(i =0; strMain[i]; i++){
        for(j =0; strMain[j+i]; j++){


The other thing I noticed is that you are checking the string against itself. Which is not similar to the description you give above (where you are comparing two different strings).