The strcspn() function scans str1 for the first occurrence of any of the characters that are part of str2, returning index value of the first matched character.
char str1 ="wikimass.com";
char str2 ="msk";
// k is the first match
len =strcspn(str1, str2);
printf("Index of first matched character: %ld", len);