Get length of substring composed of given characters: how to use strspn
#include <stdio.h>
#include <string.h>
int main ()
{
int i;
char key[] = "890th";
char str[] = "1234567890";
i = strspn (key, str);
printf ("Length of initial number is %d\n", i);
return 0;
}