-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuva-10361.cpp
78 lines (64 loc) · 1.87 KB
/
uva-10361.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
75
76
77
78
#include <bits/stdc++.h>
using namespace std;
int main()
{
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
char Line1[105], Line2[105], s2[105], s3[105], s4[105], s5[105];
int test, Len, i, j, k;
bool found;
scanf("%d", &test);
getchar();
while (test--) {
gets(Line1);
gets(Line2);
found = false;
Len = strlen(Line1);
for (i = 0; i < Len; i++) {
if (Line1[i] != '<' && Line1[i] != '>') {
putchar(Line1[i]);
}
if (Line1[i] == '<' && found == false) {
for (k = 0, j = i + 1; ; k++, j++) {
if (Line1[j] == '>') {
break;
}
s2[k] = Line1[j];
}
s2[k] = '\0';
for (k = 0, j++; ; k++, j++) {
if (Line1[j] == '<') {
break;
}
s3[k] = Line1[j];
}
s3[k] = '\0';
for (k = 0, j++; ; k++, j++) {
if (Line1[j] == '>') {
break;
}
s4[k] = Line1[j];
}
s4[k] = '\0';
for (k = 0, j++; ; k++, j++) {
if (j == Len) {
break;
}
s5[k] = Line1[j];
}
s5[k] = '\0';
found = true;
}
}
printf("\n");
Len = strlen(Line2);
for (i = 0; i < Len; i++) {
if (Line2[i] == '.') {
break;
}
putchar(Line2[i]);
}
printf("%s%s%s%s\n", s4, s3, s2, s5);
}
return 0;
}