-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path1029.c
84 lines (82 loc) · 2.04 KB
/
1029.c
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
75
76
77
78
79
80
81
82
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
#include <stdlib.h>
int main(){
char real[81],ready[81];
scanf("%s%s",ready,real);
int i,r1[37]={0},r2[37]={0},result[37]={0},ped[37]={0};
for(i=0;i<strlen(real);i++){
if(real[i]>='a'&&real[i]<='z'){
real[i]=real[i]-'a'+'A';
}
}
for(i=0;i<strlen(ready);i++){
if(ready[i]>='a'&&ready[i]<='z'){
ready[i]=ready[i]-'a'+'A';
}
}
for(i=0;i<strlen(real);i++){
if(real[i]<='9'&&real[i]>='0'){
if(r1[26+real[i]-'0']==0){
r1[26+real[i]-'0']++;
}
}
if(real[i]>='A'&&real[i]<='Z'){
if(r1[real[i]-'A']==0){
r1[real[i]-'A']++;
}
}
if(real[i]=='_'){
r1[36]=1;
}
}
for(i=0;i<strlen(ready);i++){
if(ready[i]<='9'&&ready[i]>='0'){
if(r2[26+ready[i]-'0']==0){
r2[26+ready[i]-'0']++;
}
}
if(ready[i]>='A'&&ready[i]<='Z'){
if(r2[ready[i]-'A']==0){
r2[ready[i]-'A']++;
}
}
if(ready[i]=='_'){
r2[36]=1;
}
}
for(i=0;i<37;i++){
if(r1[i]!=r2[i]){
result[i]++;
}
}
for(i=0;i<strlen(ready);i++){
if(ready[i]>='0'&&ready[i]<='9'){
if(result[26+ready[i]-'0']!=0){
if(ped[26+ready[i]-'0']==0){
printf("%c",ready[i]);
}
ped[26+ready[i]-'0']++;
}
}
if(ready[i]>='A'&&ready[i]<='Z'){
if(result[ready[i]-'A']!=0){
if(ped[ready[i]-'A']==0){
printf("%c",ready[i]);
}
ped[ready[i]-'A']++;
}
}
if(ready[i]=='_'){
if(result[36]!=0){
if(ped[36]==0){
printf("_");
}
ped[36]++;
}
}
}
return 0;
}