Ad Code

Responsive Advertisement

10338 - Mischievous Children

Author: Ismail Hosen

Daffodil International University





Problem Link

//Please follow from main function

#include<stdio.h>

#include<string.h>

int main()

{

    long long int i, n, k, l, j, sum, count, len;

    char ch[50];

    scanf("%lld", &n);

    for(k=1; k<=n; k++){

        count=1, sum=1;

        scanf("%s", ch);

        len=strlen(ch);

        for(l=len; l>=1; l--){

            sum*=l;

        }

        for(i=0; i<len; i++){

            for(j=i+1; j<len; j++){

                if(ch[i]==ch[j]){

                    count++;

                }

            }

        }

        printf("Data set %lld: %d\n",k, sum/count);

    }

    return 0;

}




Post a Comment

0 Comments