-
Notifications
You must be signed in to change notification settings - Fork 0
/
notbucode.cpp
47 lines (41 loc) · 1.01 KB
/
notbucode.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
// Brace your keyboard
// inzva community built algoleague for every algorithm enthusiast hungry for self-improvement and friendly competition. Have fun and good luck!
#include <bits/stdc++.h>
int main()
{
// write your code here
std::ios_base::sync_with_stdio(0);
std::cin.tie(0);
std::cout.tie(0);
std::string s;
std::cin >> s;
// remove all 'BUCODE' from the string
std::string bucode = "BUCODE";
for (int i = 0; i < s.size(); i++)
{
if (s[i] == 'B')
{
bool found = true;
for (int j = 0; j < bucode.size(); j++)
{
if (s[i + j] != bucode[j])
{
found = false;
break;
}
}
if (found)
{
s.erase(i, bucode.size());
i = -1;
}
}
}
if (s.size() == 0)
{
std::cout << "UTKU";
return 0;
}
std::cout << s << std::endl;
return 0;
}