不太懂 这个程序用c语言怎么写

输入一行由数字字符(不含字符'0')构成的字符串(最长不超过80字符,以回车结束),从字符串中任意的选取连续的
两个或三个数字字符,构成的数字如果是质数则称为找到一个“串中质数”,请编程计算在给定的字符串中
最多能找到多少个不同的“串中质数”

注:两个“串中质数”,只要它们中有一个字符不同或位置不同,就算不同的两个“串中质数”,例如
2131中有三个串中质数,分别为“13”、“31”和“131”

供参考,谢谢!

img

img

#include <stdio.h>

int isP(int n)
{
    if (n < 2)
        return 0;
    for (int i = 2; i < n / 2; i++)
    {
        if (n % i == 0)
            return 0;
    }
    return 1;
}

int getCount(char *s)
{
    char *p = s;
    int a, count = 0;

    puts("");
    while (*p != '\0' && *(p + 1) != '\0')
    {
        a = 10 * (*p - '0') + *(p + 1) - '0';

        if (isP(a))
        {
            count++;
            printf("%d ", a);
        }

        a *= 10;
        if (*(p + 2) != '\0')
        {
            a += *(p + 2) - '0';
            if (isP(a))
            {
                count++;
                printf("%d ", a);
            }
        }
        p++;
    }
    puts("");
    return count;
}

int main(int argc, char *argv[])
{
    char s[81];
    scanf("%80s", s);
    printf("质数个数:%d\n", getCount(s));
}