-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2013_14_C5_3
54 lines (46 loc) · 1015 Bytes
/
2013_14_C5_3
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
// Task Name : Ekspolzije
/*
At first I thought that the explosion might be able to contain the same character twice. That created a lot of problems.
The original problem did not have any additional constraints. I wonder how anyone would solve it given these constraints.
*/
#include <stdio.h>
#include <string.h>
#define z 1000006
using namespace std;
int k1,k2,j;
char s1[z], s2[z],s3[z];
inline void check(){
if(j < k2-1) return;
int fl,i;
fl = 1;
for(i = 0; i < k2; i++){
if(s2[i] != s3[j-(k2-1)+i])
fl =0;
}
if(fl==0) return;
j = j - k2;
return;
}
int main()
{
int i;
scanf("%s %s",&s1, &s2);
k1 = strlen(s1);
k2 = strlen(s2);
j = 0;
i = 0;
while(1){
if(i==k1) break;
s3[j] = s1[i];
check();
j++;
i++;
}
if(j==0) printf("FRULA\n");
if(j > 0){
for(i = 0; i < j ; i++)
printf("%c",s3[i]);
printf("\n");
}
return 0;
}