#include <iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<functional>
using namespace std;
int main()
{
int n,t,total=0;
cin>>n;
t=n;
string s;
int a[26],flag[26],i=0,j=0;
fill(a,a+26,0);
while(j<n)
{
i=0;
cin>>s;
fill(flag,flag+26,0);
while(s[i]!='\0')
{
if(!flag[int(s[i])-97])
{
a[int(s[i])-97]++;
flag[int(s[i])-97]=1;
}
i++;
}
j++;
}
for(int i=0;i<26;i++)
{
if(a[i]==t)
total++;
}
cout<<total;
return 0;
}
#include<string>
#include<algorithm>
#include<cstdlib>
#include<functional>
using namespace std;
int main()
{
int n,t,total=0;
cin>>n;
t=n;
string s;
int a[26],flag[26],i=0,j=0;
fill(a,a+26,0);
while(j<n)
{
i=0;
cin>>s;
fill(flag,flag+26,0);
while(s[i]!='\0')
{
if(!flag[int(s[i])-97])
{
a[int(s[i])-97]++;
flag[int(s[i])-97]=1;
}
i++;
}
j++;
}
for(int i=0;i<26;i++)
{
if(a[i]==t)
total++;
}
cout<<total;
return 0;
}
No comments:
Post a Comment