-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoj1168.cpp
More file actions
61 lines (58 loc) · 1.06 KB
/
oj1168.cpp
File metadata and controls
61 lines (58 loc) · 1.06 KB
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
#include <stdio.h>
#include <string.h>
#include <string>
using namespace std;
char alr[200];
char aup[200];
string utor(string a);
string delChar(string sa,string sb){
string sal=utor(sa);
string sbl=utor(sb);
int tmp=sal.find(sbl,0);
while(tmp!=string::npos){
sa.erase(tmp,sb.size());
sal.erase(tmp,sb.size());
tmp=sal.find(sbl,tmp);
}
tmp=sa.find(' ',0);
while(tmp!=string::npos){
sa.erase(tmp,1);
tmp=sa.find(' ',tmp);
}
return sa;
}
string utor(string a){
int len=a.size();
char b[len+1];
strcpy(b,a.c_str());
for(int i=0;i<len;i++)
if(b[i]>='A'&&b[i]<='Z')
b[i]=b[i]-'A'+'a';
b[len]='\0';
a=b;
return a;
}
bool isSpace(string a){
int len=a.size();
char b[200];
strcpy(b,a.c_str());
for(int i=0;i<len;i++)
if(b[i]!=' ') return false;
return true;
}
char b0[200],a0[200];
int main(){
string a,b;
gets(b0);
b=b0;
while(gets(a0)){
a=a0;
if(!strcmp(a.c_str(),"\000")||isSpace(a))
printf("\n");
else{
a=delChar(a,b);
printf("%s\n",a.c_str());
}
}
return 0;
}