-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.cpp
39 lines (39 loc) · 880 Bytes
/
test.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
#include <cstdio>
#include <cstring>
#define N 30
bool dic[N], min[N], max[N];
int main()
{
memset(dic, false, sizeof(dic));
memset(min, true, sizeof(min));
memset(max, true, sizeof(max));
char c;
while ((c = getchar()) != '\n')
{
if (c >= 'a' && c <= 'z') dic[c - 'a'] = true;
}
c = getchar();
while (c != '\n')
{
while (c < 'a' || c > 'z') c = getchar();
max[c - 'a'] = false;
c = getchar();
while (c < 'a' || c > 'z') c = getchar();
min[c - 'a'] = false;
c = getchar();
while (c != '\n' && (c < 'a' || c > 'z')) c = getchar();
}
int i = 0;
while (!dic[i] || !min[i]) i++;
printf("%c", i + 'a');
for (i++; i < 26; i++)
if (dic[i] && min[i]) printf(",%c", i + 'a');
printf("\n");
i = 0;
while (!dic[i] || !max[i]) i++;
printf("%c", i + 'a');
for (i++; i < 26; i++)
if (dic[i] && max[i]) printf(",%c", i + 'a');
printf("\n");
return 0;
}