Skip to content

Instantly share code, notes, and snippets.

@zsrinivas
Created May 26, 2014 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zsrinivas/7675af9671a24c9976fd to your computer and use it in GitHub Desktop.
Save zsrinivas/7675af9671a24c9976fd to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <ctype.h>
int main(int argc, char const *argv[])
{
int n,i,len,pint,ref[27][2]={0},elementcount=0;
char a[111];
scanf("%d", &n);
pint=n;
while(n--)
{
scanf("%s", a);
len=strlen(a);
for (i = 0; i < len; ++i)
if (ref[a[i]-'a'][0]==0)
ref[a[i]-'a'][0]++;
for (i = 0; i < 27; ++i)
{
ref[i][1]+=ref[i][0];
ref[i][0]=0;
}
}
for (i = 0; i < 27; ++i)
if (ref[i][1]==pint)
elementcount++;
printf("%d\n", elementcount);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment