-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchefing.cpp
74 lines (62 loc) · 1.83 KB
/
chefing.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <iostream>
#include <vector>
using namespace std;
/*
int main()
{
vector<unsigned int> result;
unsigned int t;
cin>>t;
for(int y=0;y<t;y++)
{
unsigned int n=0;
cin>>n;
string arr[n];
bool ing[26] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
for (unsigned short int i=0; i<n; i++)
{
cin>>arr[i];
}
unsigned int result_num=0;
for (unsigned short int pos1=0; pos1<arr[0].length(); pos1++)//points character of first string
{
unsigned int strvalid = 0;
int ascii = (int) arr[0].at(pos1);
ascii = ascii-97;
if(ing[ascii] == false)
{
continue;
}
label:
for (unsigned short int j=1; j<n; j++)
{
unsigned int count=0;
for (unsigned short int pos2=0; pos2<arr[j].length(); pos2++)//points character of nth string
{
if (arr[0].at(pos1) == arr[j].at(pos2))
{
strvalid++;
break;
}
count++;
}
if (count==arr[j].length())
{
break;
}
}
if (strvalid==n-1)
{
result_num++;
}
ing[ascii] = false;
}
result.push_back(result_num);
}
for (unsigned short int g=0; g<t; g++)
{
cout<<result[g]<<"\n";
}
return 0;
}
*/