buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> typedef long long ll; using namespace std; #define F first #define S second #define sqr(x) x *x #define pb push_back #define mp make_pair #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define allr(x) (x).rbegin(), (x).rend() #define repit(i, n) for (auto it = n.begin()...
#include <bits/stdc++.h> typedef long long ll; using namespace std; #define F first #define S second #define sqr(x) x *x #define pb push_back #define mp make_pair #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define allr(x) (x).rbegin(), (x).rend() #define repit(i, n) for (auto it = n.begin()...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["-", 15, 339, 51, 16, 12, 16, 12, 103, 0, 104], ["-", 15, 339, 51, 16, 12, 16, 12, 103, 0, 125], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, ...
1
313
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ans; ans.clear(); for (int i = 0; i < s.size(); i++) { if (s[i] == '0') { ans += '0'; } else if (s[i] == '1') { ans += '1'; } else { string tmp = ans; ans.clear(); for (int j = 0; ...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ans; ans.clear(); for (int i = 0; i < s.size(); i++) { if (s[i] == '0') { ans += '0'; } else if (s[i] == '1') { ans += '1'; } else { if (ans.size() == 0) continue; string tmp = a...
[["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25...
1
137
#include <bits/stdc++.h> using namespace std; int main() { string a, b; cin >> a; for (int i = 0; i < a.length(); i++) { if (a[i] != 'B') b.push_back(a[i]); else b.pop_back(); } cout << b; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { string a, b; cin >> a; for (int i = 0; i < a.length(); i++) { if (a[i] != 'B') b.push_back(a[i]); else if (!b.empty()) b.pop_back(); } cout << b; return 0; }
[["+", 8, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 75, 76, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 15, 339, 51, 91, 28, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 91, 28, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 91, 28, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 91, 28, 2, 3, 4, 0, 2...
1
76
s = list(input()) ans = [] for e in s: if e == "B" and len(ans) > 0: ans.pop(-1) else: ans.append(e) print(ans)
s = list(input()) ans = [] for e in s: if e == "B": if len(ans) > 0: ans.pop(-1) else: ans.append(e) print("".join(ans))
[["-", 0, 7, 8, 196, 0, 57, 15, 679, 17, 355], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], ["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 121], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 654], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 655], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319,...
5
50
#include <iostream> using namespace std; #include <algorithm> #include <sstream> #include <vector> int main(void) { // 自分の得意な言語で // Let's チャレンジ!! string str; int N; int count = 0; while (getline(cin, str)) { stringstream ss; ss << str; break; count++; } for (int i = 0; i < str.size()...
#include <iostream> using namespace std; #include <algorithm> #include <sstream> #include <vector> int main(void) { // 自分の得意な言語で // Let's チャレンジ!! string str; int N; int count = 0; while (getline(cin, str)) { stringstream ss; ss << str; break; count++; } for (int i = 0; i < str.size()...
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 75, 76, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68]]
1
137
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; vector<int> a; for (int i = 0; i < s.size(); i++) { if (s.at(i) == '0') a.push_back(0); if (s.at(i) == '1') a.push_back(1); if (s.at(i) == 'B') a.pop_back(); } for (int i = 0; i < a.size(); i++) ...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; vector<int> a; for (int i = 0; i < s.size(); i++) { if (s.at(i) == '0') a.push_back(0); if (s.at(i) == '1') a.push_back(1); if (s.at(i) == 'B' && a.size() != 0) a.pop_back(); } for (int i = 0; i < a....
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 51, 16, 12, 16, 31, 2, 63, 118, 28, 22], ["+", 51, 16, 12, 16, 31, 2, 63, 118, 17, 131], ["+", 51, 16, 12, 16, 31, 2, 63, 118, 119, 120], ["+", 51, 16, 12, 16, 31, 2, 3, 4, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12...
1
135
#include <bits/stdc++.h> using namespace std; int main() { string s, ans; cin >> s; ans = ""; for (int i = 0; i < s.size(); i++) { if (s.at(i) == '0') { ans += s.at(i); } if (s.at(i) == '1') { ans += s.at(i); } else { ans = ans.substr(0, ans.size() - 1); } } cout << ans...
#include <bits/stdc++.h> using namespace std; int main() { string s, ans; cin >> s; ans = ""; for (int i = 0; i < s.size(); i++) { if (s.at(i) == '0') { ans += s.at(i); } if (s.at(i) == '1') { ans += s.at(i); } if (s.at(i) == 'B') { ans = ans.substr(0, ans.size() - 1); ...
[["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+",...
1
120
#include <cstdio> #include <cstring> using namespace std; int main(void) { char s[11]; char a[11] = {}; int n = 0; scanf("%s", s); for (int i = 0; i < strlen(s); i++) { if (s[i] == '0') { a[n] = '0'; n++; } else if (s[i] == '1') { a[n] = '1'; n++; } else if (s[i] == 'B') ...
#include <cstdio> #include <cstring> using namespace std; int main(void) { char s[11]; char a[11] = {}; int n = 0; scanf("%s", s); for (int i = 0; i < strlen(s); i++) { if (s[i] == '0') { a[n] = '0'; n++; } else if (s[i] == '1') { a[n] = '1'; n++; } else if (s[i] == 'B') ...
[["+", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 64, 9, 0, 1, 0, 11, 12, 103, 0, 104], ["+", 64, 9, 0, 1, 0, 11, 12, 103, 0, 44], ["+", 75, 76...
1
150
#include <bits/stdc++.h> using namespace std; #define int long long #define pb emplace_back #define mp make_pair #define f(i, a, n) for (int i = a; i < n; i++) #define F first #define S second #define fast ios::sync_with_stdio(false), cin.tie(0); int32_t main() { fast; string s; cin >> s; string ans; for (...
#include <bits/stdc++.h> using namespace std; #define int long long #define pb emplace_back #define mp make_pair #define f(i, a, n) for (int i = a; i < n; i++) #define F first #define S second #define fast ios::sync_with_stdio(false), cin.tie(0); int32_t main() { fast; string s; cin >> s; string ans; for (...
[["+", 8, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 103, 0, 104], ["+", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 2...
1
103
#include <iostream> #include <string> using namespace std; int main() { string s, ans, ans1; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == '0') { string temp = "0"; ans += temp; } else if (s[i] == '1') { string temp = "1"; ans += temp; } else if (s[i] == 'B') { ...
#include <iostream> #include <string> using namespace std; int main() { string s, ans, ans1; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == '0') { string temp = "0"; ans += temp; } else if (s[i] == '1') { string temp = "1"; ans += temp; } else if (s[i] == 'B') { ...
[["+", 75, 76, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 2...
1
153
s = input() L = [] for i in range(len(s)): if s[i] == '0': L.append('0') elif s[i] == '1': L.append('1') elif s[i] == 'B': del L[-1] print(''.join(L))
s = input() L = [] for i in range(len(s)): if s[i] == '0': L.append('0') elif s[i] == '1': L.append('1') elif s[i] == 'B' and len(L) > 0: del L[-1] print(''.join(L))
[["+", 8, 196, 0, 57, 75, 665, 15, 679, 17, 355], ["+", 75, 665, 15, 679, 12, 666, 0, 652, 63, 22], ["+", 15, 679, 12, 666, 0, 652, 3, 4, 0, 24], ["+", 15, 679, 12, 666, 0, 652, 3, 4, 0, 22], ["+", 15, 679, 12, 666, 0, 652, 3, 4, 0, 25], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 667, 47], ["+", 0, 57, 75, 665, 15, 679, 1...
5
82
#include <bits/stdc++.h> using namespace std; string s; vector<char> v1; int main() { cin >> s; for (int i = 0; i < s.length(); i++) { if (s[i] == '0') { v1.push_back('0'); } else if (s[i] == '1') { v1.push_back('1'); } else if (s[i] == 'B') { v1.pop_back(); } } string st...
#include <bits/stdc++.h> using namespace std; string s; vector<char> v1; int main() { cin >> s; for (int i = 0; i < s.length(); i++) { if (s[i] == '0') { v1.push_back('0'); } else if (s[i] == '1') { v1.push_back('1'); } else if (s[i] == 'B' && !v1.empty()) { v1.pop_back(); } ...
[["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 91, 17, 111], ["+", 51, 16, 12, 91, 28, 2, 63, 118, 28, 22], ["+", 51, 16, 12, 91, 28, 2, 63, 118, 17, 131], ["+", 51, 16, 12, 91, 28, 2, 63, 118, 119, 120], ["+", 51, 16, 12, 91, 28, 2, 3, 4, 0, 24], ["+", 0, 57, 75, 76, 0, 57, 15, 339, ...
1
137
#include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <string> #include <utility> #include <vector> using namespace std; int main() { string s; cin >> s; vector<char> v; for (int i = 0; i < s.size(); ++i) { if (s[i] == '0') v.push_back('0'); el...
#include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <string> #include <utility> #include <vector> using namespace std; int main() { string s; cin >> s; vector<char> v; for (int i = 0; i < s.size(); ++i) { if (s[i] == '0') v.push_back('0'); el...
[["+", 75, 76, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 51, 16, 31, 16, 31, 2, 63, 118, 17, 131], ["+", 51, 16, 31, 16, 31, 2, 63, 118, 119, 120], ["+", 51, 16, 31, 16, 31, 2, 3, 4, 0, 24], ["+", 51, 16, 31, 16, 31, 2, 3, 4, 0, 25], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 79],...
1
136
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; string ans = ""; for (auto s : S) { if (s == '0') ans += '0'; else if (s == '1') ans += '1'; else ans.erase(ans.size() - 1); } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; string ans = ""; for (auto s : S) { if (s == '0') ans += '0'; else if (s == '1') ans += '1'; else if (!ans.empty()) ans.erase(ans.size() - 1); } cout << ans << endl; }
[["+", 75, 76, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 75, 76, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 15, 339, 51, 91, 28, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 91, 28, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 91, 28, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 91, 28, 2, 3, 4, 0,...
1
83
#include <bits/stdc++.h> using namespace std; stack<char> n, m; string temp; int main() { cin >> temp; for (int i = 0; i < temp.length(); i++) { if (!n.empty() && temp[i] == "B"[0]) { n.pop(); } else { n.push(temp[i]); } } while (!n.empty()) { m.push(n.top()); n.pop(); } whil...
#include <bits/stdc++.h> using namespace std; stack<char> n, m; string temp; int main() { cin >> temp; for (int i = 0; i < temp.length(); i++) { if (!n.empty() && temp[i] == "B"[0]) { n.pop(); } else if (temp[i] != "B"[0]) { n.push(temp[i]); } } while (!n.empty()) { m.push(n.top()); ...
[["+", 8, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 75, 76, 0, 57, 15, 339, 51, 16,...
1
142
#include <bits/stdc++.h> using namespace std; // create arrays outside of main() int N = 10; int steps[100] = {}; string input; stack<char> s; stack<char> d; int main() { cin >> input; for (int i = 0; i < input.length(); i++) { if (input[i] == '0' || input[i] == '1') { s.push(input[i]); } else if...
#include <bits/stdc++.h> using namespace std; // create arrays outside of main() int N = 10; int steps[100] = {}; string input; stack<char> s; stack<char> d; int main() { cin >> input; for (int i = 0; i < input.length(); i++) { if (input[i] == '0' || input[i] == '1') { s.push(input[i]); } else if...
[["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["+", 8, 9, 0, 52, 15, 339, 51, 91, 17, 111], ["+", 15, 339, 51, 91, 28, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 91, 28, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 91, 28, 2, 63, 118, 119, 120], ["...
1
168
// RAM RAM #include <bits/stdc++.h> #define int long long #define pb push_back #define ppb pop_back #define vi vector<int> #define mp make_pair using namespace std; set<int> v; bool hai(int n) { if (v.find(n) != v.end()) { return false; } return true; } bool valid(int n) { while (n) { if (!(hai(n % 1...
// RAM RAM #include <bits/stdc++.h> #define int long long #define pb push_back #define ppb pop_back #define vi vector<int> #define mp make_pair using namespace std; set<int> v; bool hai(int n) { if (v.find(n) != v.end()) { return false; } return true; } bool valid(int n) { while (n) { if (!(hai(n % 1...
[["-", 0, 30, 0, 14, 8, 9, 0, 171, 0, 184], ["-", 0, 30, 0, 14, 8, 9, 0, 171, 141, 22], ["-", 8, 9, 0, 171, 0, 1, 0, 2, 63, 22], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 2...
1
251
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; while (s[0] == 'B' || s[1] == 'B') { while (s[0] == 'B') { s.erase(0, 1); } while (s[1] == 'B') { s.erase(0, 2); } } while (s.find("B") != string::npos) { int leng = s.length(); for (int i = 0; ...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int leng = s.length(); while (s[0] == 'B' || s[1] == 'B') { while (s[0] == 'B') { s.erase(0, 1); leng -= 1; } while (s[1] == 'B') { s.erase(0, 2); leng -= 2; } } while (s.find("B") != stri...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 43, 49, 50, 51, 2, 63, 118, 28, 22], ["+", 0, 43, 49, 50, 51, 2, 63, 118, 17, 131], ["+", 0, 43, 49, 50, 51, 2, 63, 118, 119, 120], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["+", 0, ...
1
162
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { string s; cin >> s; string ans = ""; rep(i, s.size()) { if (s[i] == 'B') { ans.pop_back(); } else { ans.push_back(s[i]); } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { string s; cin >> s; string ans = ""; rep(i, s.size()) { if (s[i] == 'B') { if (ans != "") { ans.pop_back(); } } else { ans.push_back(s[i]); } } cout << ans << e...
[["+", 0, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 5, 0, 62], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 64, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 0, 57, ...
1
87
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <string> #include <vector> #define rep(i, N) for (int(i) = 0; (i) < (N); (i)++) using namespace std; int main() { string s, ans; cin >> s; rep(i, s.size()) { if (s[i] != 'B') ans.push_back(s[i]); else ans.pop_back(); ...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <string> #include <vector> #define rep(i, N) for (int(i) = 0; (i) < (N); (i)++) using namespace std; int main() { string s, ans; cin >> s; rep(i, s.size()) { if (s[i] != 'B') ans.push_back(s[i]); else if (ans.size() != 0) ...
[["+", 0, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 2...
1
84
// https://atcoder.jp/contests/abc043/tasks/abc043_a #include <bits/stdc++.h> using namespace std; #define int long long #define REP(i, n) FOR(i, 0, n) #define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i) #define ALL(obj) (obj).begin(), (obj).end() #define ALLR(obj) (obj).rbegin(), (obj).rend() sign...
// https://atcoder.jp/contests/abc043/tasks/abc043_a #include <bits/stdc++.h> using namespace std; #define int long long #define REP(i, n) FOR(i, 0, n) #define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i) #define ALL(obj) (obj).begin(), (obj).end() #define ALLR(obj) (obj).rbegin(), (obj).rend() sign...
[["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25...
1
136
#include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) int main() { string s; cin >> s; string stack; rep(i, s.size()) { if (s.at(i) == '0') { stack.push_back('0'); } else if (s.at(i) == '1') { stack.push_back('1'); } else { stack.pop_ba...
#include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) int main() { string s; cin >> s; string stack; rep(i, s.size()) { if (s.at(i) == '0') { stack.push_back('0'); } else if (s.at(i) == '1') { stack.push_back('1'); } else if (s.at(i) == 'B' &...
[["+", 75, 76, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 51, 16, 31, 16, 31, 2, 63, 118, 28, 22], ["+", 51, 16, 31, 16, 31, 2, 63, 118, 17, 131], ["+", 51, 16, 31, 16, 31, 2, 63, 118, 119, 120], ["+", 51, 16, 31, 16, 31, 2, 3, 4, 0, 24], ["+", 51, 16, 31, 16, 31, 2, 3, 4, 0, 22],...
1
109
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; vector<int> x = {}; for (int i = 0; i < s.size(); i++) { if (s[i] == '0') { x.push_back(0); } else if (s[i] == '1') { x.push_back(1); } else { x.pop_back(); } } for (int i = 0; i < x.size(); i++...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; vector<int> x = {}; for (int i = 0; i < s.size(); i++) { if (s[i] == '0') { x.push_back(0); } else if (s[i] == '1') { x.push_back(1); } else { if (x.size() > 0) { x.pop_back(); } else { ...
[["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+"...
1
125
#include <cstdio> int main() { char s[11]; char ans[11]; scanf("%s", s); for (char *p = s, *ap = ans; *p; ++p) { if (*p == 'B') { *ap = 0; if (ap != ans) { --ap; } } else { *ap++ = *p; *ap = 0; } } puts(ans); return 0; }
#include <cstdio> int main() { char s[11]; char ans[11]; scanf("%s", s); for (char *p = s, *ap = ans; *p; ++p) { if (*p == 'B') { if (ap != ans) { --ap; } *ap = 0; } else { *ap++ = *p; *ap = 0; } } puts(ans); return 0; }
[["-", 64, 9, 0, 1, 0, 11, 31, 66, 17, 48], ["-", 64, 9, 0, 1, 0, 11, 31, 66, 28, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 64, 9, 0, 1, 0, 11, 31, 66, 17, 48], ["+", 64, 9, 0, 1, 0, 11, 31, 66, 28, 22], ["+", 0, 57, 64, 9, 0, ...
1
100
s=list(input()) ans=[] for i in range(len(s)): if s[i]=='B' and len(ans)>0: ans.pop(-1) else: ans.append(s[i]) print(''.join(ans))
s=list(input()) ans=[] for i in range(len(s)): if s[i]=='B' and len(ans)>0: ans.pop(-1) elif s[i]!='B': ans.append(s[i]) print(''.join(ans))
[["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 57, 75, 665, 15, 666, 0, 206, 51, 22], ["+", 0, 57, 75, 665, 15, 666, 0, 206, 0, 70], ["+", 0, 57, 75, 665, 15, 666, 0, 206, 206, 22], ["+", 0, 57, 75, 665, 15, 666, 0, 206, 0, 73], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 6...
5
68
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) typedef long long ll; int main() { vector<char> ans; string s; cin >> s; for (int i = 0; i < s.length(); i++) { if (s[i] == '0' || s[i] == '1') { ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) typedef long long ll; int main() { vector<char> ans; string s; cin >> s; for (int i = 0; i < s.length(); i++) { if (s[i] == '0' || s[i] == '1') { ...
[["+", 8, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 2...
1
140
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); String a = ""; for (int i = 0; i < s.length(); i++) { String t = s.substring(i, i + 1); if (t.equals("B") && a.length() == 0) continue; ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); String a = ""; int n = 0; for (int i = 0; i < s.length(); i++) { String t = s.substring(i, i + 1); if (t.equals("B") && a.length() == 0) ...
[["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 0, 32], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 8, 498, 0, 195, 8, 196, 0, 503, 0, 35], ["-", 0, 11, 12, 492, 3, 4, 0, 16, 31, 22], ["+", 0, 11, 12, 492, 3, 4, 0, 16, 3...
3
155
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { string s; cin >> s; string ans = ""; rep(i, s.size()) { if (s[i] == 'B') { if (ans.size() > 0) ans.erase(i - 1, 1); } else ans += s[i]; } cout << ans ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { string s; cin >> s; string ans = ""; rep(i, s.size()) { if (s[i] == 'B') { if (ans.size() > 0) ans.pop_back(); } else ans.push_back(s[i]); } cout << a...
[["-", 0, 57, 64, 1, 0, 2, 63, 118, 119, 120], ["+", 0, 57, 64, 1, 0, 2, 63, 118, 119, 120], ["-", 64, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 64, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 64, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 57, 75, 76, 0, ...
1
102
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i) #define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i) #define debug(x) cerr << #x << " = " << x << "\n" #define debugv(x) \ rep(f, 0, (x.size() - 1)) cerr <<...
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i) #define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i) #define debug(x) cerr << #x << " = " << x << "\n" #define debugv(x) \ rep(f, 0, (x.size() - 1)) cerr <<...
[["-", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["-", 64, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 64, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 338, 8, 9, 0, 46], ["-", 0, 1, 0, 16, 12, 2, 63, 118, 119, 120], ["+", 0, ...
1
231
s=input() a=[] for i in s: if i=='0': a.append(i) elif i=='1': a.append(i) else: a.pop(-1) print(''.join(a))
s=input() a=[] for i in s: if i=='0': a.append(i) elif i=='1': a.append(i) else: if len(a)!=0: a.pop(-1) print(''.join(a))
[["+", 0, 57, 75, 76, 8, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 57, 15, 666, 0, 652, 63, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 79], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 0, 612], ...
5
59
#include <bits/stdc++.h> using namespace std; int main() { string s, S; cin >> s; S = ""; for (int i = 0; i < s.size(); i++) { if (s[i] == 'B') { S = S.substr(0, s.size() - 1); } else { S = S + s[i]; } } cout << S; }
#include <bits/stdc++.h> using namespace std; int main() { string s, S; cin >> s; S = ""; for (int i = 0; i < s.size(); i++) { if (s[i] == 'B') { if (S != "") { S = S.substr(0, S.size() - 1); } } else { S = S + s[i]; } } cout << S; }
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 5, 0, 62], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 3, 4, 0,...
1
92
#include <algorithm> #include <bitset> #include <cstdio> #include <cstdlib> #include <iostream> #include <math.h> #include <queue> #include <vector> using namespace std; #define INF 110000000000 #define MOD 1000000007 typedef long long ll; typedef pair<int, int> P; int main() { int count = 0; string ans = ""; st...
#include <algorithm> #include <bitset> #include <cstdio> #include <cstdlib> #include <iostream> #include <math.h> #include <queue> #include <vector> using namespace std; #define INF 110000000000 #define MOD 1000000007 typedef long long ll; typedef pair<int, int> P; int main() { int count = 0; string ans = ""; st...
[["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 0, 9,...
1
169
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define ll long long #define rep(i, l, r) for (ll i = (l); i < (r); i++) #define max(p, q) ((p) > (q) ? (p) : (q)) #define min(p, q) ((p) < (q) ? (p) : (q)) #define chmax(a, b) ((a) = (a) > (b) ? (a) : (b)) #define chmin(a, b) ((a) = (a) < (b)...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define ll long long #define rep(i, l, r) for (ll i = (l); i < (r); i++) #define max(p, q) ((p) > (q) ? (p) : (q)) #define min(p, q) ((p) < (q) ? (p) : (q)) #define chmax(a, b) ((a) = (a) > (b) ? (a) : (b)) #define chmin(a, b) ((a) = (a) < (b)...
[["-", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 64, 9, 0, 57, 64, 1, 0, 27, 28, 22], ["+", 64, 9, 0, 57, 64, 1, 0, 27, 17, 68], ["+", 0, 57, 64, 9, 0, 57, 64, 1, 0, 35], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["-", 64, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 0, 57, 64, 9, 0, 5...
0
236
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int pos = 0; string s; char t[100]; cin >> s; for (int i = 0; i < s.length(); i++) { if (pos > 0) { if (s[i] == 'B') pos--; else { t[pos] = s[i]; pos++; } } else { ...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int pos = 0; string s; char t[100]; cin >> s; for (int i = 0; i < s.length(); i++) { if (pos > 0) { if (s[i] == 'B') pos--; else { t[pos] = s[i]; pos++; } } else { ...
[["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 7, 15,...
1
125
#include <bits/stdc++.h> using namespace std; string s = ""; int main() { cin >> s; string ans = ""; for (int i = 0; i < int(s.size()); i++) { if (s[i] == '0') { ans.append("0"); } if (s[i] == '1') { ans.append("1"); } if ((s[i] == 'B') && (ans.empty())) { ans.replace(ans.siz...
#include <bits/stdc++.h> using namespace std; string s = ""; int main() { cin >> s; string ans = ""; for (int i = 0; i < int(s.size()); i++) { if (s[i] == '0') { ans.push_back('0'); } if (s[i] == '1') { ans.push_back('1'); } if ((s[i] == 'B') && (!ans.empty())) { ans.pop_back...
[["-", 64, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 64, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, 103, 0, 104], ["+", 15, 339, 51, 16, 12, 23, 0, 91, 17, 111], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 2, 3, 4, 0, 2, 63, 118, 28, 22], ["-", 0, 2, 3, 4, 0, ...
1
140
#include <iostream> using namespace std; int main() { string n; cin >> n; int s = n.length(); string ans; for (int i = 0; i < s; ++i) { if (n[i] == '0') ans += '0'; else if (n[i] == '1') ans += '1'; else if (n[i] == 'B' && i > 0) ans.erase(ans.length() - 1); } cout << ans <...
#include <iostream> #include <string> using namespace std; int main() { string n; cin >> n; int s = n.length(); string ans; for (int i = 0; i < s; ++i) { if (n[i] == '0') ans += '0'; else if (n[i] == '1') ans += '1'; else if (n[i] == 'B' && !ans.empty()) ans.erase(ans.begin() +...
[["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 91, 17, 111], ["+", 51, 16, 12, 91, 28, 2, 63, 118...
1
117
s = list(input()) ans=[] for i in s: if i == "0": ans.append("0") elif i == "1": ans.append("1") else: ans.pop() print(ans,sep ="")
s = list(input()) ans=[] for i in s: if i == "0": ans.append("0") elif i == "1": ans.append("1") else: if len(ans) == 0: continue else: ans.pop() print(*ans,sep ="")
[["+", 0, 57, 75, 76, 8, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 57, 15, 666, 0, 652, 63, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 0, 612], ...
5
63
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define SORT(c) sort((c).begin(), (c).end()) #define REVERSE(c) reverse((c).begin(), (c).end()) #define ALL(x) (x).begin(), (x).end() const long long MOD = 1000000007; const long long INF = 1LL << 60; int main() { stri...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define SORT(c) sort((c).begin(), (c).end()) #define REVERSE(c) reverse((c).begin(), (c).end()) #define ALL(x) (x).begin(), (x).end() const long long MOD = 1000000007; const long long INF = 1LL << 60; int main() { stri...
[["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 119, 120], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 24], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 25], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 25], ["+", 75, 76, 0, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 9,...
1
158
#include <bits/stdc++.h> using namespace std; int main(void) { string s; string ans; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == '0' || s[i] == '1') ans += s[i]; else { ans.pop_back(); } } cout << ans; }
#include <bits/stdc++.h> using namespace std; int main(void) { string s; string ans; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == '0' || s[i] == '1') ans += s[i]; else { if (ans.size() > 0) ans.pop_back(); } } cout << ans; }
[["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25...
1
83
#include <bits/stdc++.h> using namespace std; string s, sol; int main() { cin >> s; int len = s.size(); for (int i = 0; i < len; i++) { if (s[i] != 'B') sol += s[i]; else sol.pop_back(); } cout << sol; return 0; }
#include <bits/stdc++.h> using namespace std; string s, sol; int main() { cin >> s; int len = s.size(); for (int i = 0; i < len; i++) { if (s[i] != 'B') sol += s[i]; else if (!sol.empty()) sol.pop_back(); } cout << sol; return 0; }
[["+", 8, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 75, 76, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 15, 339, 51, 91, 28, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 91, 28, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 91, 28, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 91, 28, 2, 3, 4, 0, 2...
1
78
a = list(input()) ans = [] for b in a: if b == "0": ans.append("0") elif b == "1": ans.append("1") else: ans.pop() print("".join(ans))
a = list(input()) ans = [] for b in a: if b == "0": ans.append("0") elif b == "1": ans.append("1") elif len(ans) != 0: ans.pop() print("".join(ans))
[["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 57, 75, 665, 15, 666, 0, 652, 63, 22], ["+", 75, 665, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 75, 665, 15, 666, 0, 652, 3, 4, 0, 22], ["+", 75, 665, 15, 666, 0, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 7...
5
64
#include <bits/stdc++.h> #include <string.h> using namespace std; int main() { string s; cin >> s; string temp = ""; int k = 0; for (int i = 0; i < s.length(); i++) { if (s[i] == '0' || s[i] == '1') { temp = temp + s[i]; k++; } if (s[i] == 'B') { temp = temp.substr(0, k - 1); ...
#include <bits/stdc++.h> #include <string.h> using namespace std; int main() { string s; cin >> s; string temp = ""; int k = 0; for (int i = 0; i < s.length(); i++) { if (s[i] == '0' || s[i] == '1') { temp = temp + s[i]; k++; } if (s[i] == 'B') { if (temp.empty()) continu...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 28, 22], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 17, 131], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 119, 120], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 24], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 25], ["+...
1
122
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ans; for (int i = 0; i < s.size(); i++) { if (s[i] == '0') { ans += '0'; } else if (s[i] == '1') { ans += '1'; } else if (s[i] == 'B') { ans.pop_back(); } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ans; for (int i = 0; i < s.size(); i++) { if (s[i] == '0') { ans += '0'; } else if (s[i] == '1') { ans += '1'; } else if (s[i] == 'B') { if (ans.empty()) { continue; } else { ...
[["+", 75, 76, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 119, 120], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 24], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 25], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 64, ...
1
107
#include <bits/stdc++.h> #define rep(i, n, m) for (int i = (n); i < (m); i++) #define rrep(i, n, m) for (int i = (n)-1; i >= (m); i--) using namespace std; using ll = long long; int main() { string s; cin >> s; stack<char> ans; for (auto c : s) { if (c == 'B') { if (!ans.empty()) ans.pop(); ...
#include <bits/stdc++.h> #define rep(i, n, m) for (int i = (n); i < (m); i++) #define rrep(i, n, m) for (int i = (n)-1; i >= (m); i--) using namespace std; using ll = long long; int main() { string s; cin >> s; stack<char> ans; for (auto c : s) { if (c == 'B') { if (!ans.empty()) ans.pop(); ...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 5, 0, 62], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 52, 8, 9, 0, 1, 0...
1
128
#include <bits/stdc++.h> #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define ll long long int #define ld l...
#include <bits/stdc++.h> #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define ll long long int #define ld l...
[["+", 0, 57, 75, 76, 0, 57, 64, 57, 0, 121], ["+", 75, 76, 0, 57, 64, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0...
1
119
#include <algorithm> #include <iostream> #include <stack> #include <string> using namespace std; int main() { stack<char> w; string s; cin >> s; for (int i = 0; i < s.size(); i++) { switch (s.at(i)) { case '0': w.push('0'); break; case '1': w.push('1'); break; default: ...
#include <algorithm> #include <iostream> #include <stack> #include <string> using namespace std; int main() { stack<char> w; string s; cin >> s; for (int i = 0; i < s.size(); i++) { switch (s.at(i)) { case '0': w.push('0'); break; case '1': w.push('1'); break; default: ...
[["+", 0, 99, 8, 9, 0, 100, 0, 57, 0, 121], ["+", 8, 9, 0, 100, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25...
1
155
#include <algorithm> #include <iostream> #include <math.h> #include <queue> #include <set> #include <string.h> #include <string> #include <vector> using namespace std; int main() { string S; string T; cin >> T; for (int i = 0; i < T.size(); i++) { if (T[i] == '1') S.push_back('1'); if (T[i] == '0'...
#include <algorithm> #include <iostream> #include <math.h> #include <queue> #include <set> #include <string.h> #include <string> #include <vector> using namespace std; int main() { string S; string T; cin >> T; for (int i = 0; i < T.size(); i++) { if (T[i] == '1') S.push_back('1'); if (T[i] == '0'...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 51, 16, 12, 16, 31, 2, 63, 118, 28, 22], ["+", 51, 16, 12, 16, 31, 2, 63, 118, 17, 131], ["+", 51, 16, 12, 16, 31, 2, 63, 118, 119, 120], ["+", 51, 16, 12, 16, 31, 2, 3, 4, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12...
1
117
#include <bits/stdc++.h> using namespace std; int main() { freopen("input.txt", "r", stdin); int i, j, k, n; string str; cin >> str; int len = str.size(); for (i = 0; i < len; i++) { if (str[i] == 'B') { int temp = i; str[i] = 'x'; while (temp != -1) { temp--; if (st...
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k, n; string str; cin >> str; int len = str.size(); for (i = 0; i < len; i++) { if (str[i] == 'B') { int temp = i; str[i] = 'x'; while (temp != -1) { temp--; if (str[temp] == '0' || str[temp] == '1')...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
186
#include <bits/stdc++.h> using namespace std; int main() { string s, ans; cin >> s; for (int i = 0; i < s.size(); i++) { if (s.at(i) == '0' || s.at(i) == '1') { ans += s.at(i); } else if (ans.size() == 0) { continue; } else { ans = ans.substr(ans.size() - 1); } } cout << ans;...
#include <bits/stdc++.h> using namespace std; int main() { string s, ans; cin >> s; for (int i = 0; i < s.size(); i++) { if (s.at(i) == '0' || s.at(i) == '1') { ans += s.at(i); } else if (ans.size() == 0) { continue; } else { ans.pop_back(); } } cout << ans; }
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 1, 0, 11, 12, 2, 63, 118, 28, 22], ["-", 0, 1, 0, 11, 12, 2, 63, 118, 119, 120], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["-", 3, 4, 0, 16, 31, 2, 63, 118, 28, 22], ["-", 3, 4, 0, 16, 31, 2, 63, 118, 17, 131], ["-", 3, 4, 0, 16, 31, 2, 63, 118, 119, 120], ["+", 0, 9, ...
1
113
#include <stdio.h> #include <string.h> #define N 10 int main() { static char s[N + 1], t[N + 1]; int n, m, i; scanf("%s", s); n = strlen(s); m = 0; for (i = 0; i < n; i++) { if (s[i] != 'B') t[m++] = s[i]; else m = m > 0 ? m - 1 : 0; } printf("%s\n", t); return 0; }
#include <stdio.h> #include <string.h> #define N 10 int main() { static char s[N + 1], t[N + 1]; int n, m, i; scanf("%s", s); n = strlen(s); m = 0; for (i = 0; i < n; i++) { if (s[i] != 'B') t[m++] = s[i]; else { m = m > 0 ? m - 1 : 0; t[m] = '\0'; } } printf("%s\n", t);...
[["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 9, 0, 1, 0, 11, 31, 69, 0, 70], ["+", 0, 9, 0, 1, 0, 11, 31, 69, 71, 22], ["+", 0, 9, 0, 1, 0, 11, 31, 69, 0, 73], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 9, 0, 1, 0, 11, 12, 103, 0, 104], ["+", 0, 9, 0, 1, 0, 11, 12...
0
119
// AtCoder ABC043 B - バイナリハックイージー / Unhappy Hacking (ABC Edit) #include <bits/stdc++.h> using namespace std; using lli = int64_t; int main() { string s; cin >> s; string out; for (const auto &i : s) { if (i == '0') out.push_back('0'); else if (i == '1') out.push_back('1'); else if (i ==...
// AtCoder ABC043 B - バイナリハックイージー / Unhappy Hacking (ABC Edit) #include <bits/stdc++.h> using namespace std; using lli = int64_t; int main() { string s; cin >> s; string out; for (const auto &i : s) { if (i == '0') out.push_back('0'); else if (i == '1') out.push_back('1'); else if (i ==...
[["+", 0, 57, 75, 76, 0, 57, 64, 9, 0, 45], ["+", 75, 76, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24...
1
98
s = input() ans =[] for i in range(len(s)): if s[i] == '0': ans.append('0') elif s[i] == '1': ans.append('1') elif s[i] == 'B': ans.pop(-1) print(''.join(ans))
s = input() ans =[] for i in range(len(s)): if s[i] == '0': ans.append('0') elif s[i] == '1': ans.append('1') elif len(ans) != 0: ans.pop(-1) print(''.join(ans))
[["-", 0, 57, 75, 665, 15, 666, 0, 206, 51, 22], ["-", 0, 57, 75, 665, 15, 666, 0, 206, 0, 70], ["-", 0, 57, 75, 665, 15, 666, 0, 206, 206, 22], ["-", 0, 57, 75, 665, 15, 666, 0, 206, 0, 73], ["-", 8, 196, 0, 57, 75, 665, 15, 666, 667, 60], ["-", 0, 57, 75, 665, 15, 666, 0, 557, 0, 654], ["-", 0, 57, 75, 665, 15, 666, ...
5
83
//#include "bits/stdc++.h" #include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #include <stack> #include <tuple> #in...
//#include "bits/stdc++.h" #include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #include <stack> #include <tuple> #in...
[["+", 0, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["-", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 91, 28, 2, 63, 118, 119, 120], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-",...
1
764
// it was hard to write // so it should be hard to read #include <bits/stdc++.h> #define sz size #define pb push_back #define ll long long #define F first #define S second #define all(x) (x).begin(), (x).end() #define last(x) (x).size() - 1 #define mp make_pair using namespace std; typedef pair<int, int> pii; typedef...
// it was hard to write // so it should be hard to read #include <bits/stdc++.h> #define sz size #define pb push_back #define ll long long #define F first #define S second #define all(x) (x).begin(), (x).end() #define last(x) (x).size() - 1 #define mp make_pair using namespace std; typedef pair<int, int> pii; typedef...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 28, 22], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 17, 131], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 119, 120], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 24], ["+", ...
1
189
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); string s, res = ""; cin >> s; for (auto el : s) { if (el != 'B') res += el; else res.pop_back(); } cout << res << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); string s, res = ""; cin >> s; for (auto el : s) { if (el != 'B') res += el; else if (!res.empty()) res.pop_back(); } cout << res << endl; return 0; }
[["+", 8, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 75, 76, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 15, 339, 51, 91, 28, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 91, 28, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 91, 28, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 91, 28, 2, 3, 4, 0, 2...
1
68
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <stack> #include <stdio.h> #include <unordered_map> #include <vector> #define lld long long int #define DBG1(vari1) cerr << #vari1 << " = " << (vari1) << endl; #define DBG2(vari1, vari2) ...
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <stack> #include <stdio.h> #include <unordered_map> #include <vector> #define lld long long int #define DBG1(vari1) cerr << #vari1 << " = " << (vari1) << endl; #define DBG2(vari1, vari2) ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 64, 1, 0, 2, 3, 4, 0, 103, 0, 104], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 5, 0, 62], ["+", 0, 30, 0, ...
1
196
package main import ( "fmt" ) func main() { var s string fmt.Scan(&s) r := make([]rune, 0) for _, v := range s { if v == 'B' && len(r) > 0 { r = r[:len(r)-1] } else { r = append(r, v) } } fmt.Println(string(r)) }
package main import ( "fmt" ) func main() { var s string fmt.Scan(&s) r := make([]rune, 0) for _, v := range s { if v == 'B' && len(r) == 0 { continue } else if v == 'B' { r = r[:len(r)-1] } else { r = append(r, v) } } fmt.Println(string(r)) }
[["-", 8, 196, 0, 57, 15, 16, 12, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 17, 60], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 165], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 95], ["+"...
7
100
#include <bits/stdc++.h> using namespace std; #define pb push_back bool bo[100]; int main() { string s = "", s1 = "", s2 = ""; cin >> s; int c = 0; for (int i = 0; i < (int)s.size(); i++) { if (s[i] == 'B') { c++; } } // cout<<c<<endl; s1 = s; // cout<<s1<<endl; for (int j = 0; j < c; j+...
#include <bits/stdc++.h> using namespace std; #define pb push_back bool bo[100]; int main() { string s = "", s1 = "", s2 = ""; cin >> s; int c = 0; for (int i = 0; i < (int)s.size(); i++) { if (s[i] == 'B') { c++; } } // cout<<c<<endl; s1 = s; // cout<<s1<<endl; for (int j = 0; j < c; j+...
[["-", 15, 16, 12, 74, 51, 2, 63, 118, 28, 22], ["+", 15, 16, 12, 74, 51, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 7, 8, 9, 0, 7, 0, 88], ["+", 8, 9, 0, 7, 8, 9, 0, 7, 0, 24], ["+", 0, 7, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 4...
1
220
S=input() ans=[] for i in range(len(S)): if S[i] in ["0","1"]: ans.append(S[i]) else: ans.pop(-1) print("".join(ans))
S=input() ans=[] for i in range(len(S)): if S[i] in ["0","1"]: ans.append(S[i]) elif len(ans) > 0: ans.pop(-1) print("".join(ans))
[["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 57, 75, 665, 15, 666, 0, 652, 63, 22], ["+", 75, 665, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 75, 665, 15, 666, 0, 652, 3, 4, 0, 22], ["+", 75, 665, 15, 666, 0, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 4...
5
64
#include <bits/stdc++.h> using namespace std; // - - - - - - Data Types - - - - - - // typedef long long int LLI; typedef long int LI; typedef long long LL; // - - - - - - Vectors - - - - - - // typedef vector<int> VI; typedef vector<LLI> VLLI; typedef vector<string> VS; typedef vector<double> VD; typedef vector<VI>...
#include <bits/stdc++.h> using namespace std; // - - - - - - Data Types - - - - - - // typedef long long int LLI; typedef long int LI; typedef long long LL; // - - - - - - Vectors - - - - - - // typedef vector<int> VI; typedef vector<LLI> VLLI; typedef vector<string> VS; typedef vector<double> VD; typedef vector<VI>...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 355], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 75, 76, 0, 1, 0, 35], ["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, ...
1
617
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <string> using namespace std; #define int long long signed main() { string s; cin >> s; string ans; for (int i = 0; i < s.size(); i++) { if (s[i] == '0') ans += "0"; else if (s[i] == '1') ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <string> using namespace std; #define int long long signed main() { string s; cin >> s; string ans; for (int i = 0; i < s.size(); i++) { if (s[i] == '0') ans += "0"; else if (s[i] == '1') ...
[["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24]...
1
115
#include <bits/stdc++.h> using namespace std; int main() { string str; cin >> str; char ch[11]; int count = 1; for (int i = 0; i < str.length(); i++) { if (str[i] == '0') ch[count] = str[i], ++count; if (str[i] == '1') ch[count] = str[i], ++count; if (str[i] == 'B') if (count ==...
#include <bits/stdc++.h> using namespace std; int main() { string str; cin >> str; char ch[11]; int count = 0; for (int i = 0; i < str.length(); i++) { if (str[i] == '0') { count++; ch[count] = str[i]; } if (str[i] == '1') { count++; ch[count] = str[i]; } if (str[i...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 57, 64, 1, 0, 34, 0, 21], ["-", 0, 57, 64, 1, 0, 34, 1...
1
144
#include <bits/stdc++.h> #define REP(i, a, b) for (int i = (a); i < (b); i++) #define RREP(i, a, b) for (int i = (a); i >= (b); i--) #define pq priority_queue #define P pair<int, int> #define P2 pair<int, P> #define P3 pair<int, P2> typedef long long ll; typedef long double ld; using namespace std; const int INF = 1e9,...
#include <bits/stdc++.h> #define REP(i, a, b) for (int i = (a); i < (b); i++) #define RREP(i, a, b) for (int i = (a); i >= (b); i--) #define pq priority_queue #define P pair<int, int> #define P2 pair<int, P> #define P3 pair<int, P2> typedef long long ll; typedef long double ld; using namespace std; const int INF = 1e9,...
[["-", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 8, 1, 0, 34, 31, 2, 63, 118, 28, 22], ["+", 8, 1, 0, 34, 31, 2, 63, 118, 28, 22], ["-", 15, 339, 51, 91, 28, 2, 63, 118, 28, 22], ["+", 15,...
1
262
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) long long inf = (long long)1E17; #define i_7 (long long)(1E9 + 7) long mod(long a) { long long c = a % i_7; if (c >= 0) return c; return c + i_7; } using namespace std; bool prime(int n) { if (n == 1) { return false; } else if (n =...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) long long inf = (long long)1E17; #define i_7 (long long)(1E9 + 7) long mod(long a) { long long c = a % i_7; if (c >= 0) return c; return c + i_7; } using namespace std; bool prime(int n) { if (n == 1) { return false; } else if (n =...
[["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25...
1
486
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ans = ""; for (int i = 0; i < s.size(); i++) { switch (s[i]) { case '0': ans += "0"; break; case '1': ans += "1"; break; case 'B': ans.pop_back(); break; default: ...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ans = ""; for (int i = 0; i < s.size(); i++) { switch (s[i]) { case '0': ans += "0"; break; case '1': ans += "1"; break; case 'B': if (!ans.empty()) { ans.pop_back(); ...
[["+", 0, 99, 8, 9, 0, 100, 0, 57, 0, 121], ["+", 8, 9, 0, 100, 0, 57, 15, 339, 0, 24], ["+", 0, 100, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 15, 339, 51, 91, 28, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 91, 28, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 91, 28, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 100, 0, 57, 15, 339, 0, 25], ["...
1
103
#include <iostream> #include <string> using namespace std; int main() { string str; string str2; cin >> str; int i; for (i = 0; i < str.size(); i++) { if (str[i] == '0' || str[i] == '1') { str2.push_back(str[i]); } else { str2.pop_back(); } } cout << str2 << endl; }
#include <iostream> #include <string> using namespace std; int main() { string str; string str2; cin >> str; int i; for (i = 0; i < str.size(); i++) { if (str[i] == '0' || str[i] == '1') { str2.push_back(str[i]); } else { if (str2[0] != '\0') { str2.pop_back(); } }...
[["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 103, 0...
1
93
#include <iostream> #include <string> using namespace std; int main() { string s; string ans = ""; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == '0') ans += '0'; else if (s[i] == '1') ans += '1'; else ans.pop_back(); } cout << ans << endl; }
#include <iostream> #include <string> using namespace std; int main() { string s; string ans = ""; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == '0') ans += '0'; else if (s[i] == '1') ans += '1'; else if (s[i] == 'B' && ans != "") ans.pop_back(); } cout << ans << ...
[["+", 75, 76, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 16, 31, 69, 28, 22], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 70], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 22], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 73], ["+", 0, 57, 15, 339, 51, 16, 31, 16,...
1
95
#include <iostream> #include <string> #include <vector> int main() { std::string s; std::cin >> s; std::vector<char> a; for (int i = 0; i < s.size(); i++) { if (s[i] == '1' || s[i] == '0') { a.push_back(s[i]); } else if (!(a[i - 1] == '\0')) { a.pop_back(); } } for (int i = 0; i < a...
#include <iostream> #include <string> #include <vector> int main() { std::string s; std::cin >> s; std::vector<char> a; for (int i = 0; i < s.size(); i++) { if (s[i] == '1' || s[i] == '0') { a.push_back(s[i]); } else if (!(a.empty())) { a.pop_back(); } } for (int i = 0; i < a.size()...
[["-", 28, 23, 0, 16, 31, 69, 341, 342, 0, 70], ["-", 0, 16, 31, 69, 341, 342, 0, 16, 31, 22], ["-", 0, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 28, 23, 0, 16, 31, 69, 341, 342, 0, 73], ["-", 15, 339, 51, 91, 28, 23, 0, 16, 17, 60], ["-", 51, 91, 28, 23, 0, 16, 12, 103,...
1
140
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { string s, ans = ""; cin >> s; REP(i, s.size()) { if (s[i] == '0') ans += "0"; if (s[i] == '1') ans += "1"; if (s[i] == 'B') if (i != 0) ans.pop_back(); cout << ans << ...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { string s, ans = ""; cin >> s; REP(i, s.size()) { if (s[i] == '0') ans += "0"; if (s[i] == '1') ans += "1"; if (s[i] == 'B') if (ans.size() != 0) ans.pop_back(); } cout...
[["-", 0, 57, 64, 57, 15, 339, 51, 16, 31, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25], ["-", 0, 9, 0, 57, 64, 57, 64, 1, 0, ...
1
114
s = input() # s = "01B0" # print(s[0]) ans = [] for key in range(len(s)): if s[key] == "0" or s[key] == "1": ans.append(s[key]) if s[key] == "B": ans.pop(-1) print("".join(ans))
s = input() # s = "01B0" # print(s[0]) ans = [] for key in range(len(s)): if s[key] == "0" or s[key] == "1": ans.append(s[key]) if s[key] == "B" and len(ans) > 0: ans.pop(-1) print("".join(ans))
[["+", 0, 7, 8, 196, 0, 57, 15, 679, 17, 355], ["+", 0, 57, 15, 679, 12, 666, 0, 652, 63, 22], ["+", 15, 679, 12, 666, 0, 652, 3, 4, 0, 24], ["+", 15, 679, 12, 666, 0, 652, 3, 4, 0, 22], ["+", 15, 679, 12, 666, 0, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 47], ["+", 8, 196, 0, 57, 15, 679, 12, 666,...
5
77
s = input() ans = [] for i in s: if i == '0' or i == '1': ans.append(i) elif i == 'B': ans.pop() print(''.join(ans))
s = input() ans = [] for i in s: if i == '0' or i == '1': ans.append(i) elif i == 'B': if len(ans) == 0: pass else: ans.pop() print(''.join(ans))
[["+", 0, 57, 75, 665, 64, 196, 0, 57, 0, 121], ["+", 64, 196, 0, 57, 15, 666, 0, 652, 63, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25], ["+", 75, 665, 64, 196, 0, 57, 15, 666, 667, 60], ["+", 75, 665, 64, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 57, 75, 665, 64, 196, 0, 57,...
5
55
#include <iostream> using namespace std; int main() { string str; cin >> str; string ans; for (int i = 0; i < str.size(); i++) { if (str[i] == 'B') { ans.pop_back(); } else ans += str[i]; } cout << ans << endl; }
#include <iostream> using namespace std; int main() { string str; cin >> str; string ans; for (int i = 0; i < str.size(); i++) { if (str[i] == 'B') { if (ans.size() > 0) ans.pop_back(); } else ans += str[i]; } cout << ans << endl; }
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25]...
1
75
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <vector> #define rep(i, a, n) for (int(i) = (a); (i) < (n); (i)++) #define rrep(i, a, n) for (int(i) = (a); (i) >= (n); (i)--) #define INF 10000000 typedef long long ll; using namespace std; double...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <vector> #define rep(i, a, n) for (int(i) = (a); (i) < (n); (i)++) #define rrep(i, a, n) for (int(i) = (a); (i) >= (n); (i)--) #define INF 10000000 typedef long long ll; using namespace std; double...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0...
1
455
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; int main() { string s; cin >> s; // vector<string> t; string t; for (int i = 0; i < s.size(); i++) { if (s[i] == 'B') { t.pop_back(); } else { t.push_back(s[i]); } } ...
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; int main() { string s; cin >> s; // vector<string> t; string t; for (int i = 0; i < s.size(); i++) { if (s[i] == 'B') { if (t.size() != 0) { t.pop_back(); } } else {...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25]...
1
89
s = input() p = '' for i in range(len(s)): if s[i] == 'B': if len(p) != 0: p = p[:-1] else: p += s[i] print(p[::-1])
s = input() p = '' for i in range(len(s)): if s[i] == 'B': if 1 <= len(p): p = p[:-1] else: p += s[i] print(p)
[["+", 0, 57, 64, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 667, 19], ["-", 0, 57, 64, 196, 0, 57, 15, 666, 667, 79], ["-", 0, 57, 64, 196, 0, 57, 15, 666, 0, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70], ["-", 0, 652, 3, 4, 0, 206, 206, 663, 0, 102], ["-", 3, 4, 0, 206, 206, 663, 0, 664, 17...
5
64
s=input() ans="" for x in s: if x == 'B' and len(ans)>0: ans=ans[:len(ans)-1] else: ans+=x print(ans)
s=input() ans="" for x in s: if x == 'B' and len(ans)>0: ans=ans[:len(ans)-1] else: if x != 'B': ans+=x print(ans)
[["+", 0, 57, 75, 76, 8, 196, 0, 57, 0, 121], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 79], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 6], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 655], ["+", 0, 57, 75, 76, 8, 196, 0, 57, 0, 10...
5
49
#include <iostream> #include <string> using namespace std; int main() { int i, len; string n, result; cin >> n; len = n.length(); for (i = 0; i < len; i++) { cout << n[i] << endl; if ((n[i] == '0') or (n[i] == '1') or (n[i] == 'B')) { if ((n[i] == '0') or (n[i] == '1')) { result += n[i]...
#include <iostream> #include <string> using namespace std; int main() { int i, len; string n, result; cin >> n; len = n.length(); for (i = 0; i < len; i++) { if ((n[i] == '0') or (n[i] == '1') or (n[i] == 'B')) { if ((n[i] == '0') or (n[i] == '1')) { result += n[i]; } else { i...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 0, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 70], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 73], ["-", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 0,...
1
176
#include <bits/stdc++.h> using namespace std; using llong = long long; using P = pair<llong, llong>; #define BE(x) x.begin(), x.end() const llong inf = llong(1e18) + 7; const llong mod = 1e9 + 7; int main() { string s; cin >> s; string a; for (auto x : s) if (x == 'B') a.pop_back(); else ...
#include <bits/stdc++.h> using namespace std; using llong = long long; using P = pair<llong, llong>; #define BE(x) x.begin(), x.end() const llong inf = llong(1e18) + 7; const llong mod = 1e9 + 7; int main() { string s; cin >> s; string a; for (auto x : s) if (x == 'B') { if ((int)a.size() > 0) ...
[["+", 8, 9, 0, 338, 8, 57, 64, 9, 0, 45], ["+", 0, 338, 8, 57, 64, 9, 0, 57, 0, 121], ["+", 8, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 74, 0, 24], ["+", 15, 339, 51, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 57, 15, 339, 51, 16, 31, 74, 0, 25], ["+", 51, 16, 31, 74, 51, 2, 63, 118, 119, 120], ...
1
98
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { string ttt; cin >> ttt; string ans = "99999999999"; int a = 0; for (int i = 0; i < ttt.size(); i++) { switch (ttt.at(i)) { case '0': ans.at(a) = '0'; a++; break; case '1': ans.at(a) = '1'; ...
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { string ttt; cin >> ttt; string ans = "99999999999"; int a = 0; for (int i = 0; i < ttt.size(); i++) { switch (ttt.at(i)) { case '0': ans.at(a) = '0'; a++; break; case '1': ans.at(a) = '1'; ...
[["+", 0, 99, 8, 9, 0, 100, 0, 57, 0, 121], ["+", 8, 9, 0, 100, 0, 57, 15, 339, 0, 24], ["+", 0, 100, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 100, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 100, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 100, 0, 57, 15, 339, 0, 25], ["+", 0, 100, 0, 57, 64, 1, 0, 27, 28, 22], ["+...
1
172
#include <bits/stdc++.h> using namespace std; using i64 = int64_t; const i64 MOD = 1e9 + 7; const i64 INF = 1e18 + 7; signed main() { int a, b, c, d, n, x, y; string s, t; auto Yes = [&](bool t) { cout << (t ? "Yes" : "No") << endl; }; auto YES = [&](bool t) { cout << (t ? "YES" : "NO") << endl; }; auto...
#include <bits/stdc++.h> using namespace std; using i64 = int64_t; const i64 MOD = 1e9 + 7; const i64 INF = 1e18 + 7; signed main() { int a, b, c, d, n, x, y; string s, t; auto Yes = [&](bool t) { cout << (t ? "Yes" : "No") << endl; }; auto YES = [&](bool t) { cout << (t ? "YES" : "NO") << endl; }; auto...
[["+", 75, 76, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 28, 22], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 17, 131], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 119, 120], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 24], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 25],...
1
204
#include <bits/stdc++.h> using namespace std; long n, k; string s, kq = ""; int main() { cin >> s; for (long i = 0; i < s.size(); i++) { if (s[i] == '0') kq += '0'; if (s[i] == '1') kq += '1'; if (s[i] == 'B') kq.erase(kq.size() - 1, 1); } cout << kq << endl; }
#include <bits/stdc++.h> using namespace std; long n, k; string s, kq = ""; int main() { cin >> s; for (long i = 0; i < s.size(); i++) { if (s[i] == '0') kq += '0'; if (s[i] == '1') kq += '1'; if (s[i] == 'B') if (kq.size() != 0) kq.erase(kq.size() - 1, 1); } cout << kq << ...
[["+", 0, 7, 8, 9, 0, 57, 64, 57, 0, 121], ["+", 8, 9, 0, 57, 64, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25]...
1
115
#include <bits/stdc++.h> using namespace std; int main() { string S, ans; cin >> S; for (int i = 0; i < S.length(); i++) { if (S[i] == '0') { ans.push_back('0'); } else if (S[i] == '1') { ans.push_back('1'); } else { ans.pop_back(); } } cout << ans; }
#include <bits/stdc++.h> using namespace std; int main() { string S, ans; cin >> S; for (int i = 0; i < S.length(); i++) { if (S[i] == '0') { ans.push_back('0'); } else if (S[i] == '1') { ans.push_back('1'); } else { if (ans.size() > 0) { ans.pop_back(); } } } ...
[["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25...
1
99
#include <bits/stdc++.h> using namespace std; int main() { string S, ans; cin >> S; for (int i = 0; i < S.length(); i++) { if (S[i] == '0') { ans.push_back('0'); } else if (S[i] == '1') { ans.push_back('1'); } else { ans.pop_back(); } } cout << ans; }
#include <bits/stdc++.h> using namespace std; int main() { string S, ans; cin >> S; for (int i = 0; i < S.length(); i++) { if (S[i] == '0') { ans.push_back('0'); } else if (S[i] == '1') { ans.push_back('1'); } else { if (ans.size()) { ans.pop_back(); } } } cout...
[["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 28, 22], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 17, 131], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 119, 120], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 24], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 25], ["...
1
99
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); List<String> ans = new ArrayList<String>(); for (int i = 0; i < s.length(); i++) { if (s.charAt(i...
import java.util.ArrayList; import java.util.List; import java.util.Scanner; // B - 文字列大好きいろはちゃんイージー / Iroha Loves Strings (ABC Edition) public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); List<String> ans = new ArrayList<String>(); ...
[["+", 8, 196, 0, 57, 75, 57, 75, 196, 0, 45], ["-", 0, 57, 75, 57, 75, 57, 15, 15, 0, 24], ["-", 15, 15, 0, 16, 31, 16, 31, 492, 500, 22], ["-", 15, 15, 0, 16, 31, 16, 31, 492, 0, 131], ["-", 15, 15, 0, 16, 31, 16, 31, 492, 141, 22], ["-", 0, 16, 31, 16, 31, 492, 3, 4, 0, 22], ["-", 0, 16, 31, 16, 31, 492, 3, 4, 0, 25...
3
207
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { string s; cin >> s; vector<char> v; for (int i = 0; i < s.size(); i++) { char tmp = s[i]; if (tmp == '0') { v.push_back('0'); } else if (tmp == '1') { v.push_back('1'); } else if (tmp == 'B') { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { string s; cin >> s; vector<char> v; for (int i = 0; i < s.size(); i++) { char tmp = s[i]; if (tmp == '0') { v.push_back('0'); } else if (tmp == '1') { v.push_back('1'); } else if (tmp == 'B') { ...
[["+", 75, 76, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 2...
1
131
s = list(input()) #key =s.copy() #print(s) a = [] #count = 0 for i in s: # print(s) if i == 'B' and s.index(i) == 0: pass elif i == 'B': a = a[:-1] #del a[-1] else: a.append(i) print(''.join(a))
s = list(input()) #key =s.copy() #print(s) a = [] #count = 0 for i in s: # print(s) if i == 'B' and s.index(i) == 0: a = a[:-1] elif i == 'B': a = a[:-1] #del a[-1] else: a.append(i) print(''.join(a))
[["-", 8, 196, 0, 57, 64, 196, 0, 674, 0, 675], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 64, 196, 0, 1, 0, 662, 12, 206, 51, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 206, 0, 70], ["+", 0, 1, 0, 662, 12, 206, 206, 663, 0, 102], ["+", 0, 662, 12, 206, 206, 663, 0, 664, 1...
5
72
#include <bits/stdc++.h> #include <string> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) using namespace std; #include <stack> int main() { char s[100]; char a[100]; int top = 0; int read = 0; cin >> a; while (a[read]) { if (a[read] == 'B') { top--; } else { s[top] = a[read]; ...
#include <bits/stdc++.h> #include <string> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) using namespace std; #include <stack> int main() { char s[100000]; char a[100000]; int top = 0; int read = 0; cin >> a; while (a[read]) { if (a[read] == 'B') { if (top != 0) top--; } else {...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, ...
1
112
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { string s; cin >> s; stack<char> result; for (int i = 0; i < s.size(); ++i) { char c = s[i]; if (c == '0') { result.push('0'); } else if (c == '1') { result.push('1'); } else if (c == 'B' && 0 < result.s...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { string s; cin >> s; vector<char> result; for (int i = 0; i < s.size(); ++i) { char c = s[i]; if (c == '0') { result.push_back('0'); } else if (c == '1') { result.push_back('1'); } else if (c == 'B' && 0...
[["-", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["-", 64, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 64, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["-", 0, 1, 0, 16, 12, 2, 63, 118, 17, 131], ["-", 0, 1, 0, 16, 12, 2, 63, 118, 119, 120], ["-", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["-", 0,...
1
162
#include <algorithm> #include <cstdlib> #include <iostream> //入出力 #include <map> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <string> #include <vector> #include <iomanip> //小数点以下を表示させる(setprecision()) #define debug(x) \ ...
#include <algorithm> #include <cstdlib> #include <iostream> //入出力 #include <map> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <string> #include <vector> #include <iomanip> //小数点以下を表示させる(setprecision()) #define debug(x) \ ...
[["-", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
178
# -*- coding: utf-8 -*- # 文字列の入力 S = input() T = '' for i in range(len(S)): print(S[i]) if S[i] == '0': T += '0' elif S[i] == '1': T += '1' elif S[i] == 'B': T = T[:-1] print(T)
# -*- coding: utf-8 -*- # 文字列の入力 S = input() T = '' for i in range(len(S)): if S[i] == '0': T += '0' elif S[i] == '1': T += '1' elif S[i] == 'B': T = T[:-1] print(T)
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 206, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 0, 73], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
81
#include <bits/stdc++.h> using namespace std; int main() { int ans = 0, a = 0, b = 0, c = 0; char tmp; vector<char> S; string T; cin >> T; S.push_back(T[0]); for (int i = 1; i < T.size(); i++) { if (T[i] == 'B') { if (S.size() == 0) continue; S.pop_back(); } else S.push...
#include <bits/stdc++.h> using namespace std; int main() { int ans = 0, a = 0, b = 0, c = 0; char tmp; vector<char> S; string T; cin >> T; for (int i = 0; i < T.size(); i++) { if (T[i] == 'B') { if (S.size() == 0) continue; S.pop_back(); } else S.push_back(T[i]); } f...
[["-", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["-", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["-", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["-", 0, 2, 3, 4, 0, 69, 3...
1
149
#Bとその前1文字を消せば良い s =list(input()) lis = [] for i in range(len(s)): if s[i] == "B": if len(lis)>1: lis[i-1]="" lis.append("") else: lis.append(s[i]) print("".join(lis))
#Bとその前1文字を消せば良い s =list(input()) lis = [] for i in range(len(s)): if s[i] == "B": if len(lis) >0: lis.pop() else: lis.append(s[i]) print("".join(lis))
[["-", 0, 57, 64, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 0, 612], ["-", 64, 196, 0, 1, 0, 662, 31, 206, 0, 70], ["-", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["-", 0, 1, 0, 662, 31, 206, 206, 657, 17, 33], ["-", 0, 1, 0, 662, 31, 206, 206, 657, 12, 612], ["-", 64, 196, 0, 1, 0, 662, 31, 2...
5
79
#include <bits/stdc++.h> using namespace std; int main() { string s, ans; cin >> s; for (int i = 0; i < (int)s.size(); i++) { if (s[i] == '1') ans += '1'; else if (s[i] == '0') ans += '0'; else ans.erase((int)ans.size() - 1, 1); } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { string s, ans; cin >> s; for (int i = 0; i < (int)s.size(); i++) { if (s[i] == '1') ans += '1'; else if (s[i] == '0') ans += '0'; else { if (ans.empty()) continue; ans.erase((int)ans.size() - 1, 1); } } ...
[["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 28, 22], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 17, 131], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 119, 120], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 24], ["...
1
107
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ans; for (int i = 0; i < s.size(); i++) { if (!ans.empty()) ans.pop_back(); else ans.push_back(s[i]); } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ans; for (int i = 0; i < s.size(); i++) { if (s[i] == 'B') { if (!ans.empty()) ans.pop_back(); } else ans.push_back(s[i]); } cout << ans << endl; }
[["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 103, 0, 104], ["+", 0, 57, 15, 339, 51, 16, 12...
1
74
// template #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<long long, long long> LP; #define INF 999999999 #define MOD 1000000007 #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define REP_AB(i, a, b) for (int i = int(a); i <= int(b); ++i) #define ALL(v) v.begin...
// template #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<long long, long long> LP; #define INF 999999999 #define MOD 1000000007 #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define REP_AB(i, a, b) for (int i = int(a); i <= int(b); ++i) #define ALL(v) v.begin...
[["-", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["-", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 8, 9, 0, 52, 15, 339, 51, 91, 17, 111], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 15, 339, 51, 91, 28, 2, 63, 118, 119, 120], ["+", 0, 43,...
1
351
#include <iostream> using namespace std; int main(int argc, char *argv[]) { string s; cin >> s; string ans; for (int i = 0; i < s.size(); i++) { if (s[i] == '0' || s[i] == '1') { ans += s[i]; } else { ans.erase(ans.end() - 1); } } cout << ans << endl; return 0; }
#include <iostream> using namespace std; int main(int argc, char *argv[]) { string s; cin >> s; string ans; for (int i = 0; i < s.size(); i++) { if (s[i] == '0' || s[i] == '1') { ans += s[i]; } else if (ans.size() > 0) { ans.erase(ans.end() - 1); } } cout << ans << endl; return...
[["+", 8, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 2...
1
104
#include <iostream> #include <string> #include <vector> int main() { std::string inputString; std::cin >> inputString; std::vector<char> charVec; for (char &c : inputString) { if (c == '0' || c == '1') { charVec.push_back(c); } else { charVec.pop_back(); } } for (char &d : charV...
#include <iostream> #include <string> #include <vector> int main() { std::string inputString; std::cin >> inputString; std::vector<char> charVec; for (char &c : inputString) { if (c == '0' || c == '1') { charVec.push_back(c); } else { if (charVec.size() == 0) { continue; } ...
[["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+"...
1
92
'use strict' function Main(input) { let output = ''; for (let i = 0; i < input.length; i++) { if (input[i] == '0') { output += '0'; } else if (input[i] == '1') { output += '1'; } else { output = output.slice(0, -1); } } console.log(output); } Main(require("fs").readFileSync("/...
'use strict' function Main(input) { input = input.split('\n')[0].split(''); let output = ''; for (let i = 0; i < input.length; i++) { if (input[i] == '0') { output += '0'; } else if (input[i] == '1') { output += '1'; } else { output = output.slice(0, -1); } } console.log(outp...
[["+", 0, 435, 8, 556, 0, 1, 0, 11, 31, 22], ["+", 0, 435, 8, 556, 0, 1, 0, 11, 0, 32], ["+", 63, 558, 500, 69, 500, 2, 63, 558, 500, 22], ["+", 63, 558, 500, 69, 500, 2, 63, 558, 0, 131], ["+", 63, 558, 500, 69, 500, 2, 63, 558, 559, 560], ["+", 63, 558, 500, 69, 500, 2, 3, 3, 0, 24], ["+", 500, 69, 500, 2, 3, 3, 0, 5...
2
116
s=input() s_list=list(s) string=[] for i, x in enumerate(s_list): if x=='0': string.append('0') if x=='1': string.append('1') if x=='B': string.pop() string_out=''.join(string) print(string_out)
s=input() s_list=list(s) string=[] for i, x in enumerate(s_list): if x=='0': string.append('0') if x=='1': string.append('1') if x=='B': if len(string) != 0 : string.pop() else: pass string_out=''.join(string) print(string_out)
[["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 121], ["+", 64, 196, 0, 57, 15, 666, 0, 652, 63, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 667, 79], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 0, 612], ["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 10...
5
80
#include <stdio.h> #include <string.h> int main(int argc, char const *argv[]) { char s[11]; int i, piv = 0; char ans[11]; memset(s, '\0', 11); memset(ans, '\0', 11); scanf("%s", s); for (i = 0; i < strlen(s); i++) { if (s[i] == 'B') { ans[piv] = '\0'; if (piv != 0) piv--; } ...
#include <stdio.h> #include <string.h> int main(int argc, char const *argv[]) { char s[11]; int i, piv = 0; char ans[11]; memset(s, '\0', 11); memset(ans, '\0', 11); scanf("%s", s); // printf("%lu\n",strlen(s) ); for (i = 0; i < strlen(s); i++) { if (s[i] == 'B') { if (piv != 0) piv...
[["-", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 64, 9, 0, 1, 0, 11, 31, 69, 0, 70], ["-", 64, 9, 0, 1, 0, 11, 31, 69, 71, 22], ["-", 64, 9, 0, 1, 0, 11, 31, 69, 0, 73], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 64, 9, 0, 1, 0, 11, 12, 103, 0, 104], ["-", 64, 9, 0, 1, 0, 11, 12, 103, 0, 44], ["-", 8, 9, 0, 57, 6...
0
145