submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s068934166 | p04030 | C++ | #include<cstring>
#include<cstdio>
int main(){
char key[100];
char s[100];
int x = 0;
scanf("%s", key);
for(int i=0; i>strlen(key); i++){
if(key[i] == "B"){
if(x != 0){
x--;
}
else{
s[x] = key[i];
x++;
}
}
}
printf("%s", s);
return 0;
} | a.cc: In function 'int main()':
a.cc:10:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | if(key[i] == "B"){
| ~~~~~~~^~~~~~
|
s566549626 | p04030 | C++ | #include<cstring>
#include<cstdio>
int main(){
char key[100];
char s[100];
int x = 0;
scanf("%s", key);
for(int i=0; i>strlen(key); i++){
if(key[i]="B"){
if(x != 0){
x--;
}
else{
s[x] = key[i];
x++;
}
}
}
printf("%s", s);
return 0;
} | a.cc: In function 'int main()':
a.cc:10:15: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
10 | if(key[i]="B"){
| ^~~
| |
| const char*
|
s018546834 | p04030 | C++ | #include<cstdio>
int main(){
char key[100];
char s[100];
int x = 0;
scanf("%s", key);
for(int i=0; i>strlen(key); i++){
if(key[i]="B"){
if(x != 0){
x--;
}
else{
s[x] = key[i];
x++;
}
}
print("%s", s);
return 0;
} | a.cc: In function 'int main()':
a.cc:8:18: error: 'strlen' was not declared in this scope
8 | for(int i=0; i>strlen(key); i++){
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<cstdio>
+++ |+#inclu... |
s068041407 | p04030 | C++ | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
char pop_back(char *str)
{
const int len = strlen(str);
if( len == 0 ) {
return '\0';
} else {
char c = str[len-1];
str[len-1] = '\0';
return c;
}
}
i... | a.cc: In function 'char pop_back(char*)':
a.cc:8:21: error: 'strlen' was not declared in this scope
8 | const int len = strlen(str);
| ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <algorithm>
... |
s183201979 | p04030 | C++ | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string s;
cin >> s;
string ans = "";
for(int i = 0; i < s.size(); i++) {
if(s[i] == '0') {
ans.push_back('0');
}
else if(s[i] == '1') {
ans.push_back('1');
... | a.cc: In function 'int main()':
a.cc:23:26: error: no matching function for call to 'std::__cxx11::basic_string<char>::erase(std::__cxx11::basic_string<char>::iterator, int)'
23 | ans.erase(ans.end(), 1);
| ~~~~~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string... |
s667939976 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(void)
{
cahr s[15];
char tmp;
int i=0;
while(cin>>tmp){
if(tmp=='B'){
if(i>0){
s[i-1]='\0';
i--;
}
}
else{
s[i]=tmp;
i++;
}
}
for(inti=0;i<15;i++){
if(s[i]=='0'||s[i]=='1')
cout<<s[i];
... | a.cc: In function 'int main()':
a.cc:6:3: error: 'cahr' was not declared in this scope; did you mean 'char'?
6 | cahr s[15];
| ^~~~
| char
a.cc:12:9: error: 's' was not declared in this scope
12 | s[i-1]='\0';
| ^
a.cc:17:7: error: 's' was not declared in this scope
17 ... |
s021011798 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(void)
{
char s[10];
char l[10];
cin>>s;
for(int i=0;i<strlen(s);i++){
if(s[i]=='0')
s.push_back('0');
if(s[i]=='1')
s.push_back('1');
if(s[i]==' ')
l[i-1]=' ';
}
cout<<l<<endl;
} | a.cc: In function 'int main()':
a.cc:12:9: error: request for member 'push_back' in 's', which is of non-class type 'char [10]'
12 | s.push_back('0');
| ^~~~~~~~~
a.cc:14:9: error: request for member 'push_back' in 's', which is of non-class type 'char [10]'
14 | s.push_back('1');
... |
s625692765 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(void)
{
string s;
string l;
cin>>s;
for(int i=0;i<strlen(s);i++){
if(s[i]=='0')
s.push_back('0');
if(s[i]=='1')
s.push_back('1');
if(s[i]==' ')
l[i-1]=' ';
}
cout<<l<<endl;
} | a.cc: In function 'int main()':
a.cc:9:24: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
9 | for(int i=0;i<strlen(s);i++){
| ^
| |
| std::string {aka std::__cxx11::basic_string<ch... |
s153832167 | p04030 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
char s[15];
char tmp;
int i = 0;
while(cin >> tmp){
if(tmp=='B'){
if(i>0){
s[i-1] ='\0';
i--;
}
}
else{
s[i] = tmp;
i++;
... | a.cc: In function 'int main()':
a.cc:29:2: error: expected '}' at end of input
29 | }
| ^
a.cc:8:11: note: to match this '{'
8 | int main(){
| ^
|
s510121154 | p04030 | C++ | #include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<unordered_map>
#include<stack>
#include<string>
#include<algorithm>
#include<functional>
#include<cstring>
#include<utility>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
/**** Type Define ****/
typedef long lo... | a.cc: In function 'int main()':
a.cc:188:36: error: expected ';' before '}' token
188 | if(s.size()!=0)ans.pop_back()
| ^
| ;
189 | }
| ~
|
s177201690 | p04030 | C++ | #include <iostream>
#include <string>
#include <iomanip>
#include <ios>
using namespace std;
int main(void){
string s;
cin >> s;
int n = s.length()
string ans = "";
for(int i=0;i<n;i++){
if(s[i] == '0')
ans += '0';
else if(s[i] == '1')
ans += '1';
else{
if(ans.length())
... | a.cc: In function 'int main()':
a.cc:11:3: error: expected ',' or ';' before 'string'
11 | string ans = "";
| ^~~~~~
a.cc:15:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
15 | ans += '0';
| ^~~
| abs
a.cc:17:7: error: 'ans' was not declared in this sco... |
s444228122 | p04030 | C++ | #include <iostream>
#include <string>
#include <iomanip>
#include <ios>
using namespace std;
int main(void){
string s;
cin >> s;
int n = s.length()
string ans = "";
for(int i=0;i<n;i++){
if(s[i] == '0')
s += '0';
else if(s[i] == '1')
s += '1';
else{
if(ans.length())
... | a.cc: In function 'int main()':
a.cc:11:3: error: expected ',' or ';' before 'string'
11 | string ans = "";
| ^~~~~~
a.cc:19:10: error: 'ans' was not declared in this scope; did you mean 'abs'?
19 | if(ans.length())
| ^~~
| abs
a.cc:24:11: error: 'ans' was not declare... |
s033343660 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(void)
{
string s;
cin>>s;
string s1;
for(int i=0;i<s.size();i++){
if(s[i]=='0')
s1[i]='0';
if(s[i]=='1')
s[i]='1';
if(s[i+1]=='B'&&(i+1)<s.size())
s[i-1]='';
}
cout<<s1<<endl;
} | a.cc:15:14: error: empty character constant
15 | s[i-1]='';
| ^~
|
s365796752 | p04030 | C++ | #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{ans-=ans.at(ans.size()-1);}
}
cout<<ans;
} | a.cc: In function 'int main()':
a.cc:8:13: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'})
8 | else{ans-=ans.at(ans.size()-1);}
| ~~~^~~~~~~~~~~~~~~~~~~... |
s180253439 | p04030 | C++ | #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{ans-=s.at(i-1);}
}
cout<<ans;
} | a.cc: In function 'int main()':
a.cc:8:13: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'})
8 | else{ans-=s.at(i-1);}
| ~~~^~~~~~~~~~~
|
s956961833 | p04030 | C++ | #inlucde <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
vector<char> data;
for(int i=0; i<s.size(); i++){
if(s.at(i) == '0'){
data.push_back(0);
}else if(s.at(i) == '1'){
data.push_back(1);
}else{
data.pop_back();
}
}
for(int i=0; i<data.size(); i++){... | a.cc:1:2: error: invalid preprocessing directive #inlucde; did you mean #include?
1 | #inlucde <bits/stdc++.h>
| ^~~~~~~
| include
a.cc: In function 'int main()':
a.cc:5:3: error: 'string' was not declared in this scope
5 | string s;
| ^~~~~~
a.cc:1:1: note: 'std::string' is defined in h... |
s509802706 | p04030 | C++ | #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.at(i) == '0')
ans.push_back('0');
else if (s.at(i) == '1')
ans.push_back('1');
else
ans.pop_back;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:17:11: error: invalid use of non-static member function 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::pop_back() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
17 | ans.pop_back;
| ~~~~^~~~~~~~
In file include... |
s002336516 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s; cin >> s;
string ans = "";
for(int i = 0; i < s.length(): i ++) {
switch (s[i])
{
case '0':
ans += '0';
break;
case '1':
ans += '1';
break;
case 'B':
... | a.cc: In function 'int main()':
a.cc:7:20: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
7 | for(int i = 0; i < s.length(): i ++) {
| ^
a.cc:7:34: error: expected ';' before ':' token
7 | for(int i = 0; ... |
s137758844 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int size = 0;
vector<int> t(s.size(),2)
for(int i = 0; i < s.size(); i++){
if(s[i] == '0'){
t[i] = 0;
size++;
}
else if(s[i] == '1'){
t[i] = 1;
size++;
}
else {
if(size >= 1){
... | a.cc: In function 'int main()':
a.cc:9:3: error: expected ',' or ';' before 'for'
9 | for(int i = 0; i < s.size(); i++){
| ^~~
a.cc:9:18: error: 'i' was not declared in this scope
9 | for(int i = 0; i < s.size(); i++){
| ^
|
s773164416 | p04030 | C++ | #include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;
int main(){
string s; cin >> s;
string ans;
for(int i=0;i<s.size();i++){
if(s[i]=='B'&&ans.size()>0)ans.pop_back();
else if(s[i]!='B')ans.push_back(s[i])
}
cout << ans << endl;
... | a.cc: In function 'int main()':
a.cc:11:46: error: expected ';' before '}' token
11 | else if(s[i]!='B')ans.push_back(s[i])
| ^
| ;
12 | }
| ~
|
s246612273 | p04030 | C++ | #include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;
int main(){
string s; cin >> s;
string ans;
for(int i=0;i<s.size();i++){
if(s[i]=='B'&&t.size()>0)t.pop_back();
else if(s[i]!='B')t.push_back(s[i])
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:10:23: error: 't' was not declared in this scope
10 | if(s[i]=='B'&&t.size()>0)t.pop_back();
| ^
|
s682239730 | p04030 | C++ | #include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <stdio.h>
#include <set>
#include <vector>
using namespace std;
int main(){
string s;
cin>>s;
vector<char> v;
for(auto i: s){
if(i=='0'){
v.pb('0');
}
else if(i=='1'){
v... | a.cc: In function 'int main()':
a.cc:16:15: error: 'class std::vector<char>' has no member named 'pb'
16 | v.pb('0');
| ^~
a.cc:19:15: error: 'class std::vector<char>' has no member named 'pb'
19 | v.pb('1');
| ^~
|
s305392133 | p04030 | C++ | #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]=='B') {
if(count==0)continue;
else count--... | a.cc: In function 'int main()':
a.cc:14:17: error: expected primary-expression before '}' token
14 | }
| ^
a.cc:18:17: error: expected primary-expression before '}' token
18 | }
| ^
a.cc:26:34: error: invalid types 'int[int]' for array su... |
s564573740 | p04030 | C++ | #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]=='B') {
if(count==0)continue;
else count--... | a.cc: In function 'int main()':
a.cc:14:17: error: expected primary-expression before '}' token
14 | }
| ^
a.cc:18:17: error: expected primary-expression before '}' token
18 | }
| ^
a.cc:26:34: error: invalid types 'int[int]' for array su... |
s251814521 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
char str[11];
gets(str);
for(int i=0;i<strlen(str);i++){
if(str[i]=='B')str[i]='x',str[i-1]='x';
}
for(int i=0;i<strlen(str);i++){
if(str[i]=='x') continue;
else
cout<<str[i];
}
cout<<endl;
} | a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
7 | gets(str);
| ^~~~
| getw
|
s842601913 | p04030 | C++ | #include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
string s;
cin >> s;
s+=0;
for(int i=0;i<s.size();i++){
if(s[i]!='B'&&s[i+1]!='B') cout << s[i];
}
cout << endl;
}
| a.cc: In function 'int main()':
a.cc:11:6: error: ambiguous overload for 'operator+=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
11 | s+=0;
| ~^~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
... |
s330069071 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
string X;
for (int i = 0; i < S.size(); i++) {
if(S[i] == 0) {
X += "0";
}
else if (S[i] == 1) {
X += "1";
}
else if (S[i] == "B") {
if (X != "") {
X.erase(X.size() - 1);
}
... | a.cc: In function 'int main()':
a.cc:16:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
16 | else if (S[i] == "B") {
|
s770326930 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
string X;
for (int i = 0; i < S.size(); i++) {
if(S[i] == 0) {
X += "0";
}
else if (S[i] == 1) {
X += "1";
}
else if (S[i] == B) {
if (X != "") {
X.erase(X.size() - 1);
}
}
... | a.cc: In function 'int main()':
a.cc:16:22: error: 'B' was not declared in this scope
16 | else if (S[i] == B) {
| ^
|
s422733939 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
string X;
for (int i = 0; i < S.size(); i++) {
if(S[i] == 0) {
X += 0;
}
else if (S[i] == 1) {
X += 1;
}
else if (S[i] == B) {
if (X != "") {
X.erase(X.size() - 1);
}
}
}
... | a.cc: In function 'int main()':
a.cc:11:9: error: ambiguous overload for 'operator+=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
11 | X += 0;
| ~~^~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
... |
s399709868 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin S;
string X;
for (int i = 0; i < S.size(); i++) {
if(S[i] == 0) {
X += 0;
}
else if (S[i] == 1) {
X += 1;
}
else if (S[i] == B) {
if (X != "") {
X.erase(X.size() - 1);
}
}
}
c... | a.cc: In function 'int main()':
a.cc:6:6: error: expected ';' before 'S'
6 | cin S;
| ^~
| ;
a.cc:11:9: error: ambiguous overload for 'operator+=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
11 | X += 0;
| ~~^~~~
In file included ... |
s696644492 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int pos = 0;
vector<char> o(s.size());
for(auto& c : S){
if(c=='B'){
pos = max(0, pos-1);
}else{
o[pos] = c;
pos++;
}
}
for(int ii=0; ii<pos; ii++){
cout << o[ii];
}
cout << endl;
return... | a.cc: In function 'int main()':
a.cc:9:17: error: 'S' was not declared in this scope
9 | for(auto& c : S){
| ^
|
s142689266 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int pos = 0;
string o(s.size());
for(auto& c : S){
if(c=='B'){
pos = max(0, pos-1);
}else{
o[pos] = c;
pos++;
}
}
for(int ii=0; ii<pos; ii++){
cout << o[ii];
}
cout << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:20: error: no matching function for call to 'std::__cxx11::basic_string<char>::basic_string(std::__cxx11::basic_string<char>::size_type)'
8 | string o(s.size());
| ^
In file included from /usr/include/c++/14/string:54,
from /usr/incl... |
s231278713 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int i, c;
string s, result = "";
cin >> s;
for(i= n.size()-1; i>=0; i--){
if(s[i] == 'B'){
c++;
}else if(c > 0){
c--;
}else{
result = s[i] + result;
}
}
cout << result;
... | a.cc: In function 'int main()':
a.cc:8:12: error: 'n' was not declared in this scope
8 | for(i= n.size()-1; i>=0; i--){
| ^
|
s143765038 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int i, c;
string s, result = "";
cin >> s;
for(i= n.size()-1, i>=0; i--){
if(s[i] == 'B'){
c++;
}else if(c > 0){
c--;
}else{
result = s[i] + result;
}
}
cout << result;
... | a.cc: In function 'int main()':
a.cc:8:12: error: 'n' was not declared in this scope
8 | for(i= n.size()-1, i>=0; i--){
| ^
a.cc:8:33: error: expected ';' before ')' token
8 | for(i= n.size()-1, i>=0; i--){
| ^
| ... |
s633117022 | p04030 | C++ | #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a... | a.cc: In function 'int main()':
a.cc:31:15: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
31 | printf(S[i]);
| ~~~~~~^~~~~~
| |
| __gnu_cxx::__alloc_traits<s... |
s436641680 | p04030 | C++ | #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a... | a.cc: In function 'int main()':
a.cc:31:9: error: 'print' was not declared in this scope; did you mean 'rint'?
31 | print(S[i]);
| ^~~~~
| rint
|
s158660309 | p04030 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
string s, ans;
cin >> s;
for (int i = 0; i < s.size(); i++){
if(s(i) == 0){
string += '0';
} else if (s(i) == 1){
string += '1';
} else string--;
}
cout >> ans >> endl;
} | a.cc: In function 'int main()':
a.cc:10:9: error: no match for call to '(std::string {aka std::__cxx11::basic_string<char>}) (int&)'
10 | if(s(i) == 0){
| ~^~~
a.cc:11:14: error: expected unqualified-id before '+=' token
11 | string += '0';
| ^~
a.cc:12:17: error: no matc... |
s897831389 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s,ans;
cin>>s;
int i=0;
for(i=0;i<s.size();i++){
if(s[i]=="0"){
ans[i]="0"
}else if(s[i]=="1"){
ans[i]="1"
}else if(s[i]=="B"){
if(ans.size()!=0){
ans[i-1] = " ";
i = i-1;
}
}
}
cout<<an... | a.cc: In function 'int main()':
a.cc:9:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
9 | if(s[i]=="0"){
a.cc:10:14: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
10 | ans... |
s294359151 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s, t(0);
cin >> s;
int i;
for(i = 0; i < s.size(); i++){
if(s.at(i) == '0'){
t += '0';
}
else if(s.at(i) == '1'){
t += '1';
}
else if(s.at(i-1) == '0'){
t -= '0';
}
else if(s.at(i-1) == '1'){
... | a.cc: In function 'int main()':
a.cc:17:9: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
17 | t -= '0';
| ~~^~~~~~
a.cc:20:9: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<c... |
s924549204 | p04030 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long unsigned int ll;
int main() {
string s;
string t;
int a,b,c,d,i,j,k;
cin >> s;
for(i=0;i<s.length();i++){
if(s[i]=='1') t.back()='1';
if(s[i]=='0') t.back()='0';
... | a.cc: In function 'int main()':
a.cc:19:34: error: 'erase' was not declared in this scope
19 | if(s[i]=='0'&&s.length()>=1) erase(t.back());
| ^~~~~
|
s422743193 | p04030 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long unsigned int ll;
int main() {
string s;
string t;
int a,b,c,d,i,j,k;
cin >> s;
for(i=0;i<s.length();i++){
if(s[i]=='1') t.back()=='1';
if(s[i]=='0') t.back()=='0';
... | a.cc: In function 'int main()':
a.cc:19:34: error: 'erase' was not declared in this scope
19 | if(s[i]=='0'&&s.length()>=1) erase(t.back());
| ^~~~~
|
s493651298 | p04030 | C++ | #include <iostream>
#include <string>
//#include <algorithm>
using namespace std;
int main() {
//vars;
string str;
//input;
cin >> str;
//process;
for (int i = 0; i < str.size; i++) {
if (str[0] == 'B') {
str.erase(str.begin());
i--;
}
if (str[i] == 'B'&&i > 0) {
str.erase(str.begin() + i - 1, s... | a.cc: In function 'int main()':
a.cc:14:33: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsig... |
s703216128 | p04030 | C | #include <stdio.h>
#include <string.h>
int main()
{
char s[11], out[11]={'\0'};
scanf("%s", s);
n = strlen(s);
for(int i=0; i<n; i++){
int m = strlen(out);
if(s[i] == 'B') out[m-1]='\0';
else out[m]=s[i];
}
printf("%s", out);
return 0;
} | main.c: In function 'main':
main.c:8:3: error: 'n' undeclared (first use in this function)
8 | n = strlen(s);
| ^
main.c:8:3: note: each undeclared identifier is reported only once for each function it appears in
|
s891668926 | p04030 | C++ | #include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#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 euclid_distance(doubl... | a.cc: In function 'void solve()':
a.cc:85:8: error: 'i' was not declared in this scope
85 | ep(i,0,s.size()){
| ^
a.cc:85:5: error: 'ep' was not declared in this scope; did you mean 'exp'?
85 | ep(i,0,s.size()){
| ^~
| exp
|
s662264978 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main () {
string s;
cin >> s;
deque<char> data;
for(int i = 0; i < s.size(); i--) {
if(s.at(i) == 'B' && !data.empty())data.pop_back();
else if(s.at(i) == '1' || s.at(i) == '2')data.push_back(s.at(i));
}
while(!data.empty()) {
cout << data.front(... | a.cc: In function 'int main()':
a.cc:13:10: error: invalid use of non-static member function 'void std::deque<_Tp, _Alloc>::pop_front() [with _Tp = char; _Alloc = std::allocator<char>]'
13 | data.pop_front;
| ~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/deque:66,
from /usr/... |
s673232132 | p04030 | C | #include<stdio.h>
int main(){
char S[11];
scanf("%s",S);
int i;
for(i=1;i<=9;i++){
if(S[i] == 'B'){
S[i] = ¥0;
S[i-1] = ¥0;
};
};
printf(S);
} | main.c: In function 'main':
main.c:9:14: error: stray '\302' in program
9 | S[i] = <U+00A5>0;
| ^~~~~~~~
main.c:10:16: error: stray '\302' in program
10 | S[i-1] = <U+00A5>0;
| ^~~~~~~~
|
s138868397 | p04030 | C++ | #include<cstdio>
#include<string>
char s[101],s2[101];
int s1,a;
int main()
{
scanf("%s",s);
s1=strlen(s);
for(int i=0; i<s1; i++)
{
switch(s[i])
{
case'0':s2[a]='0';
a++;
break;
case'1':s2[a]='1';
a++;
break;
case'B':if(a!=0)
a--;
break;... | a.cc: In function 'int main()':
a.cc:8:12: error: 'strlen' was not declared in this scope
8 | s1=strlen(s);
| ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<string>
+++ |+#include <cstring>
3 |... |
s259593719 | p04030 | C++ | #include<cstdio>
#include<string>
char s[101],s2[101];
int s1,a;
int main()
{
gets(s);
s1=strlen(s);
for(int i=0; i<s1; i++)
{
switch(s[i])
{
case'0':s2[a]='0';
a++;
break;
case'1':s2[a]='1';
a++;
break;
case'B':if(a!=0)
a--;
break;
... | a.cc: In function 'int main()':
a.cc:7:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
7 | gets(s);
| ^~~~
| getw
a.cc:8:12: error: 'strlen' was not declared in this scope
8 | s1=strlen(s);
| ^~~~~~
a.cc:3:1: note: 'strlen' is defined in hea... |
s915953964 | p04030 | C++ | /*#include<cstdio>
#include<string.h>
char str[101],answer[101];
int lens,i,lena=0;
int main()
{
gets(str);
lens=strlen(str),
for(i=0;i<lens;i++)
switch(str[i])
{
case '0':answer[lena]='0';lena++;break;
case '1':answer[lena]='1';lena++;break;
case 'B':if(lena... | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s065692847 | p04030 | C++ | sefwrwrwwrwr | a.cc:1:1: error: 'sefwrwrwwrwr' does not name a type
1 | sefwrwrwwrwr
| ^~~~~~~~~~~~
|
s724324188 | p04030 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
int i, len;
string n, result;
cin >> n;
len = n.length();
for(i=0; i < 10; 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')){
... | a.cc: In function 'int main()':
a.cc:20:15: error: expected primary-expression before 'continue'
20 | }else(continue;)
| ^~~~~~~~
a.cc:20:15: error: expected ')' before 'continue'
20 | }else(continue;)
| ~^~~~~~~~
| )
a.cc:20:24: error: ex... |
s277480835 | p04030 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
string s;
int i=0;
while(cin>>s){
if(s[i]=='0')s.push('0');
else if(s[i]=='1')s.push('1');
else s.pop_back();
}
cout<<s<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:24: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push'
10 | if(s[i]=='0')s.push('0');
| ^~~~
a.cc:11:29: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pu... |
s169011223 | p04030 | C++ | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
string s, ans;
int N = s.size();
ans = "";
for(int i = 0, i < N; i++){
if( s.at(i) != 'B'){
ans = ans + s.at(i);
}
else if(ans.size() > 1 && s.at(i) == 'B'){
int a = ans.size();
string X = "";
for(i... | a.cc: In function 'int main()':
a.cc:10:19: error: expected ';' before '<' token
10 | for(int i = 0, i < N; i++){
| ^~
| ;
a.cc:10:20: error: expected primary-expression before '<' token
10 | for(int i = 0, i < N; i++){
| ^
|
s446895495 | p04030 | C++ | #include<iostream>
#include <bits/stdc++.h>
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) = '... | a.cc: In function 'int main()':
a.cc:17:15: error: expected ':' before ';' token
17 | case '1';
| ^
| :
a.cc:21:15: error: expected ':' before ';' token
21 | case 'B';
| ^
| :
|
s008953502 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define Abs(x)((x) < 0 ? (x) * -1 : (x))
#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y... | a.cc: In function 'int main()':
a.cc:77:36: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push'
77 | if (s[i] == '0') s.push('0');
| ^~~~
a.cc:78:41: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'}... |
s511398368 | p04030 | C++ | #include<stdio.h>
int main(){
char s[100],k = 'B';
scanf("%s",&s);
for(int i = 1;i < strlen(s);i++){
if(s[i] == k){
int j = i - 1;
while(s[j] == k && j > 0){
j--;
}
s[j] = k;
}
}
for(int i = 0;i < strlen(s);i++){
if(s[i] != k){
printf("%c",s[i]);
}
}
... | a.cc: In function 'int main()':
a.cc:6:21: error: 'strlen' was not declared in this scope
6 | for(int i = 1;i < strlen(s);i++){
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<stdio.h>
+++ |+#i... |
s621002351 | p04030 | C++ | #include "bits/stdc++.h"
using namespace std;
#define Would
#define you
const long long INF = 99999999999999999;
const long long MOD = 1e9 + 7;
const double pi = 3.1415926535897932384626;
const int SIZE = 1 << 17;
int main() {
string h;
cin >> h;
vector<char>ans;
for (int i = 0; i < h.length(); ++i) {
if (h[i] =... | a.cc: In function 'int main()':
a.cc:15:49: error: no matching function for call to 'push_back(const char [2])'
15 | if (h[i] == '0') { ans.push_back("0"); }
| ~~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/vector:66,
from /usr/i... |
s319458730 | p04030 | C++ | using namespace std;
int main(void){
string str;
cin >> str;
string ans="";
for(int i=0; i<str.size(); i++){
if(str[i]=='0') ans+='0';
if(str[i]=='1') ans+='1';
if(str[i]=='B'){
if(!str.empty()) ans.pop_back();
}
}
cout << ans << endl;
return 0... | a.cc: In function 'int main()':
a.cc:4:5: error: 'string' was not declared in this scope
4 | string str;
| ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
+++ |+#include <string>
1 | using namespace std;
a.cc:5:5: error... |
s382355822 | p04030 | C | #include<stdio.h>
int main(){
int len = 0, i = 0;
char s[11], t[11];
scanf("%s", s);
while(s[len]){
if(s[len] == '0'){
t[i++] = 0;
} else if(s[len] == '1'){
t[i++] = 1;
} else if(s[len] == 'B'){
if(i != 0){
t[--i] = '\0';
}
}
len++;
}
for (j = i; j ... | main.c: In function 'main':
main.c:21:8: error: 'j' undeclared (first use in this function)
21 | for (j = i; j >= 0; j--){
| ^
main.c:21:8: note: each undeclared identifier is reported only once for each function it appears in
|
s752331080 | p04030 | C++ | #include <iostream>
using namespace std;
int main()
{
char s[11];
cin >> s;
char ans[11];
int flag=0;
int i = strlen(s);
for (int j=0; j<i; j++){
if(s[j]=='0'){
ans[flag]='0';
flag++;
}else if(s[j]=='1'){
ans[flag]='1';
flag++;
... | a.cc: In function 'int main()':
a.cc:10:13: error: 'strlen' was not declared in this scope
10 | int i = strlen(s);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
... |
s207005004 | p04030 | C | #include<stdio.h>
int main(void){
int i=0,j=0;
char s[11];
char t[11];
scanf("%s",&s);
while(s[i]!='\0'){
if(s[i]!='B'){
t[j]=s[i];
j++;
}else{
if(j<1){
j=j-j;
}else{
j=j-1;
}
}
t[j]='\0';
printf("%s\n",t);
return 0;
} | main.c: In function 'main':
main.c:21:3: error: expected declaration or statement at end of input
21 | }
| ^
|
s959158133 | p04030 | C++ | #include<stdio.h>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
char ch[10000];
cin>>ch;
int len = strlen(ch);
int l = 100;
int r = 101;
int ans[1000];
for(int i= 0;i<len;i++)
{
if(ch[i]... | a.cc: In function 'int main()':
a.cc:39:14: error: expected '}' at end of input
39 | return 0;
| ^
a.cc:10:1: note: to match this '{'
10 | {
| ^
|
s886369461 | p04030 | C++ | #include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
int main() {
char a[100];
gets(a);
int n = strlen(a);
char b[100];
int j = 0;
for(int i = 0; i < n; i++) {
if(a[i] == '0')
b[j++] = '0';
if(a[i] == '1')
b[j++] = '1';
if(... | a.cc: In function 'int main()':
a.cc:7:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
7 | gets(a);
| ^~~~
| getw
|
s496708347 | p04030 | C | #include <cstdio>
#include <cstring>
int main(){
char s[105];
char ch[105];
int cnt=0;
scanf("%s",s);
for(int i=0;i<strlen(s);i++){
if(s[i]=='B'&&i>0){
s[i-1]='B';
}
}
for(int i=0;i<=strlen(s);i++){
if(s[i]=='B')cnt++;
else ch[i-cnt]=s[i];
}
printf("%s\n",ch);
}
| main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s558798210 | p04030 | C | #include <cstdio>
#include <cstring>
int main(){
char s[15];
for(int i=0;i<15;i++){
scanf("%c",&s[i]);
if(s[i]=='B'&&i>0){i-=2;continue;}
if(s[i]=='\n')break;
}
for(int i=0;i<strlen(s);i++){
printf("%c",s[i]);
}
return 0;
}
| main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s084854434 | p04030 | C++ | #include<stdio.h>
#include<string.h>
#define N 11
char str[N];
char end[N];
int main()
{
int i,len;
gets(str);
len = strlen(str);
for(i=0 ; i<len ; i++)
{
if(str[i]=='0') end[i]='0';
if(str[i]=='B') end[i]='\b';
if(str[i]=='1') end[i]='1';
}
printf("%s\n",end);
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
9 | gets(str);
| ^~~~
| getw
|
s417867778 | p04030 | C++ | #include<stdio.h>
#include<string.h>
#define N 99
char str[N];
char end[N];
int main()
{
int i,len;
gets(str);
len = strlen(str);
for(i=0 ; i<len ; i++)
{
if(str[i]=='0') end[i]='0';
if(str[i]=='B') end[i]='\b';
if(str[i]=='1') end[i]='1';
}
printf("%s\n",end);
return 0;
} | a.cc: In function 'int main()':
a.cc:9:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
9 | gets(str);
| ^~~~
| getw
|
s624339267 | p04030 | C | #include <stdio.h>
#include <string.h>
int main() {
char s[11] = { 0 };
char t[11] = { 0 };
int p = 0;
scanf("%s", s);
for (int i = 0; i < strlen(s); i++) {
if (s[i] == 'B') {
if (p != 0) {
p--;
}
} else {
t[p++] = s[i];
... | main.c: In function 'main':
main.c:22:5: error: expected declaration or statement at end of input
22 | return 0;
| ^~~~~~
|
s148039734 | p04030 | C++ | #include<bits/stdc++.h>
int main()
{
char str[101],ans[101];
gets(str);
int i,lena=0;
for(i=0;i<strlen(str);i++)
switch(str[i])
{
case '0':
ans[lena]='0';
lena++;
break;
case '1':
ans[lena]='1';
lena++;
break;
case 'B':
if(l... | a.cc: In function 'int main()':
a.cc:5:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
5 | gets(str);
| ^~~~
| getw
|
s714258773 | p04030 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
int j=0;
string s;
vector<char> str2;
cin >> s;
for(int i=0;i<s;i++){
if(s.at(i)=='0'){
str2.at(j)='0';
j++;
}
else if(s.at(i)=='1'){
str2.at(j)='1';
j++;
... | a.cc: In function 'int main()':
a.cc:10:18: error: no match for 'operator<' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
10 | for(int i=0;i<s;i++){
| ~^~
| | |
| | std::string {aka std::__cxx11::basic_string... |
s680651565 | p04030 | C++ | #include <bits/stdc++.h>
char str[101],answer[101];
int main()
{
gets(str);
int lens=strlen(str),i,lena=0;
for(i=0;i<lens;i++)
switch(str[i])
{
case '0':answer[lena]='0';lena++;break;
case '1':answer[lena]='1';lena++;break;
case 'B':if(lena!=0) lena--... | a.cc: In function 'int main()':
a.cc:6:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
6 | gets(str);
| ^~~~
| getw
a.cc:17:2: error: expected '}' at end of input
17 | }
| ^
a.cc:4:1: note: to match this '{'
4 | {
| ^
|
s186352921 | p04030 | Java | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Stack;
public class AtCoderAbc043A {
public static void main(String[] args)throws Exception {
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
String word = input.readLine();
Stack<... | Main.java:5: error: class AtCoderAbc043A is public, should be declared in a file named AtCoderAbc043A.java
public class AtCoderAbc043A {
^
1 error
|
s264510540 | p04030 | C | #include<cstdio>
#include<cstring>
char stop,ans[12],c[12];
int len,str;
int main()
{int s;
scanf("%s",c);
len=strlen(c);
for(int i=1;i<=len;i++)
{
stop=c[i];
if(stop=='B')
{if(str>0)
{
str--;
ans[str]='\0';
}}
else{ans[str]=stop;
str++;
}
}
printf("%s",ans);
} | main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s941825609 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
if (s.at(0) != 'B') {
cout << s.at(0);
}
for (int i = 1; i < n - 1; i ++) {
if (s.at(i + 1) != 'B' || s.at(i) != 'B') {
cout << s.at(i);
}
}
if (s.at(s.size() - 1) != 'B') {
cout << s.at(s.size() - 1);
... | a.cc: In function 'int main()':
a.cc:11:23: error: 'n' was not declared in this scope
11 | for (int i = 1; i < n - 1; i ++) {
| ^
|
s135133963 | p04030 | C++ | #include <iostream>
#include<cstring>
using namespace std;
int main()
{
char str[101], answer[101];
gets(str);
int lens = strlen(str), i, lena = 0;
for (i = 0; i < lens; i++)
switch (str[i])
{
case '0':answer[lena] = '0'; lena++; break;
case '1':answer[lena] = '1'; lena++; break;
case 'B':if (lena != 0) le... | a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
7 | gets(str);
| ^~~~
| getw
|
s019252564 | p04030 | C++ | #include <iostream>
using namespace std;
int main()
{
char str[101], answer[101];
gets(str);
int lens = strlen(str), i, lena = 0;
for (i = 0; i < lens; i++)
switch (str[i])
{
case '0':answer[lena] = '0'; lena++; break;
case '1':answer[lena] = '1'; lena++; break;
case 'B':if (lena != 0) lena--; break;
}
f... | a.cc: In function 'int main()':
a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
6 | gets(str);
| ^~~~
| getw
a.cc:7:20: error: 'strlen' was not declared in this scope
7 | int lens = strlen(str), i, lena = 0;
| ^~~~... |
s286941273 | p04030 | C++ | #include<bits/c++std.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
map<string, int> mp;
int main() {
string s;
cin >> s;
vector<char> ans;
for (int i = 0; i < s.size();i++) {
if (s[i] == '0') {
ans.push_back('0');
}
if (s[i] == '1') {
... | a.cc:1:9: fatal error: bits/c++std.h: No such file or directory
1 | #include<bits/c++std.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s219224315 | p04030 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <thread>
#include <chrono>
#include <queue>
using namespace std;
int main(void){
string s;
queue<char> q;
cin >> s;
for(int i=0;i<s.length();i++){
if(s.at(i)=='0'){
q.push('0');
}else i... | a.cc: In function 'int main()':
a.cc:29:26: error: no match for 'operator[]' (operand types are 'std::queue<char>' and 'int')
29 | cout << q[i];
| ^
|
s279057601 | p04030 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <thread>
#include <chrono>
#include <queue>
using namespace std;
int main(void){
string s;
queue<char> q;
cin >> s;
for(int i=0;i<s.length();i++){
if(s.at(i)=='0'){
q.push('0');
}else i... | a.cc: In function 'int main()':
a.cc:29:26: error: no match for 'operator[]' (operand types are 'std::queue<char>' and 'int')
29 | cout << q[i];
| ^
a.cc:30:19: error: invalid use of non-static member function 'void std::queue<_Tp, _Sequence>::pop() [with _Tp = char; _S... |
s697273022 | p04030 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <thread>
#include <chrono>
#include <queue>
using namespace std;
int main(void){
string s;
queue<char> q;
cin >> s;
for(int i=0;i<s.length();i++){
if(s.at(i)=='0'){
q.push('0');
}else i... | a.cc: In function 'int main()':
a.cc:29:22: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::queue<char>')
29 | cout << q;
| ~~~~ ^~ ~
| | |
| | std::queue<char>
... |
s264147343 | p04030 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <thread>
#include <chrono>
#include <queue>
using namespace std;
int main(void){
string s;
queue<char> q;
cin >> s;
for(int i=0;i<s.length();i++){
if(s.at(i)=='0'){
q.push('0');
}else i... | a.cc: In function 'int main()':
a.cc:28:25: error: 'class std::queue<char>' has no member named 'length'
28 | for(int i=0;i<q.length();i++){
| ^~~~~~
a.cc:29:22: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::queue<c... |
s208265697 | p04030 | C++ | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string s, t;
cin >> s;
for (int i = 0; i < s.size(); i++) {
if (s[i] == 0) t += "0";
if (s[i] == 1) t += "1";
if (s[i] == "B") t.pop_back();
}
cout << t;
return 0;
} | a.cc: In function 'int main()':
a.cc:13:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
13 | if (s[i] == "B") t.pop_back();
|
s612583384 | p04030 | C++ | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string s, t;
cin >> s;
for (int i = 0; i < s.sixe(); i++) {
if (s[i] == 0) t += "0";
if (s[i] == 1) t += "1";
if (s[i] == "B") t.pop_back();
}
cout << t;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:25: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'sixe'; did you mean 'size'?
10 | for (int i = 0; i < s.sixe(); i++) {
| ^~~~
| size
a.cc:13:14: error: ISO C++ forbids com... |
s389873540 | p04030 | C++ | #include <iostream>
#include <string>
#include <algorithm>
int main() {
string s, t;
cin >> s;
for (int i = 0; i < s.sixe(); i++) {
if (s[i] == 0) t += "0";
if (s[i] == 1) t += "1";
if (s[i] == "B") t.pop_back();
}
cout << t;
return 0;
} | a.cc: In function 'int main()':
a.cc:6:3: error: 'string' was not declared in this scope
6 | string s, t;
| ^~~~~~
a.cc:6:3: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostrea... |
s700899988 | p04030 | C++ | #include <iostream>
#include <string>
using namespace std;
int main() {
string str, ans;
cin >> str;
for (auto s : str) {
if (s != 'B')
ans += s;
else if (!ans.empty()) {
auto it = ans.end();
ans.erace(--it);
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:13:11: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'erace'; did you mean 'erase'?
13 | ans.erace(--it);
| ^~~~~
| erase
|
s437471045 | p04030 | C++ | #include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<string>
#include<vector>
#include<tuple>
#include<stack>
#include<iomanip>
#include<map>
using namespace std;
int main() {
string s;
int i,n;
cin >> s;
n = strlen (s);
i = 0;
while (s[i] == 'B') {
s[i] = 2;
i++;
}
int j;
for ... | a.cc: In function 'int main()':
a.cc:17:13: error: 'strlen' was not declared in this scope
17 | n = strlen (s);
| ^~~~~~
a.cc:11:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
10 | #include<map>
+++ |+#include <cstring>
11... |
s870723817 | p04030 | C++ | #include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<string>
#include<vector>
#include<tuple>
#include<stack>
#include<iomanip>
#include<map>
using namespace std;
int main() {
string s;
int i,n;
cin >> s;
n = strlen (s);
i = 0;
while (s[i] == 'B') {
s[i] == 2;
i++;
}
int j;
for... | a.cc: In function 'int main()':
a.cc:17:13: error: 'strlen' was not declared in this scope
17 | n = strlen (s);
| ^~~~~~
a.cc:11:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
10 | #include<map>
+++ |+#include <cstring>
11... |
s745835697 | p04030 | C++ | #include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<string>
#include<vector>
#include<tuple>
#include<stack>
#include<iomanip>
#include<map>
using namespace std;
int main() {
string s;
int i,n;
cin >> s;
n = strlen(s);
i = 0;
while (s[i] == 'B') {
s[i] == 2;
i++;
}
int j;
for ... | a.cc: In function 'int main()':
a.cc:17:13: error: 'strlen' was not declared in this scope
17 | n = strlen(s);
| ^~~~~~
a.cc:11:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
10 | #include<map>
+++ |+#include <cstring>
11 ... |
s011115720 | p04030 | C++ | #include <iostream>
using namespace std;
int main(int argc, char const *argv[]) {
cin.tie(0);
ios::sync_with_stdio(false);
string s;
cin >> s;
string ans;
for (int i = 0; i < s.length(); ++i) {
if (s[i] == 'B') {
ans.pop_back();
} else {
if (ans.length > 0) {
ans.push_back(s[i])... | a.cc: In function 'int main(int, const char**)':
a.cc:14:15: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; siz... |
s940872302 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
string ans;
for (char c : s) {
if (c == 1) {
ans+='1'
}
else if (c == 0) {
ans+='0'
}
else {
if (s.begin() == s.end()) {
continue;
}
else {
ans.erase(ans.end() - 1);
}
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:9:33: error: expected ';' before '}' token
9 | ans+='1'
| ^
| ;
10 | }
| ~
a.cc:12:33: error: expected ';' before '}' toke... |
s289163188 | p04030 | C++ | #include<bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
string ans;
for (char c : s) {
if (c == 1) {
ans+='1'
}
else if (c == 0) {
ans+='0'
}
else {
if (s.begin() == s.end()) {
continue;
}
else {
s.erase(s.end() - 1);
}
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:9:33: error: expected ';' before '}' token
9 | ans+='1'
| ^
| ;
10 | }
| ~
a.cc:12:33: error: expected ';' before '}' toke... |
s390589181 | p04030 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >>s;
int n=-1;
string t=" ";
for(int i =0; i< s.size(); i++) {
if(s[i] == "B" && n>=0) {
t[n--] = "";
} else {
t[++n] = s[i];
}
}
cout << t << endl;
} | a.cc: In function 'int main()':
a.cc:10:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | if(s[i] == "B" && n>=0) {
a.cc:11:34: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermi... |
s136997075 | p04030 | C++ | #include <iostream>
#include <string.h>
using namespace std;
int main()
{
char s[100],s1[100];
cin>>s;
for(int i=0; i<strlen(s); i++){
s1[i]='2';
if(s1[i]=='B'&&i==0){
continue;
}
else{
if(s[i]=='0'){
s1[i]='0';
}
else if(s[i]=... | a.cc: In function 'int main()':
a.cc:31:2: error: expected '}' at end of input
31 | }
| ^
a.cc:6:1: note: to match this '{'
6 | {
| ^
|
s748739331 | p04030 | C++ | #include <iostream>
#include <string.h>
using namespace std;
int main()
{
char s[100],s1[100];
cin>>s;
for(int i=0; i<strlen(s); i++){
s1[i]='2';
if(s1[i]=='B'){
continue;
}
else{
if(s[i]=='0'){
s1[i]='0';
}
else if(s[i]=='1'){... | a.cc: In function 'int main()':
a.cc:31:2: error: expected '}' at end of input
31 | }
| ^
a.cc:6:1: note: to match this '{'
6 | {
| ^
|
s341481287 | p04030 | C++ | #include <cstdio>
#include <stack>
#include <cstring>
using namespace std;
stack<int> s;
int main()
{
int n, lim;
char str[15];
gets(str+1);
n = strlen(str);
for(int i=1; i<n; i++)
{
if(str[i] == '0' || str[i] == '1')
s.push(str[i]);
else
s.pop();
... | a.cc: In function 'int main()':
a.cc:14:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
14 | gets(str+1);
| ^~~~
| getw
|
s077741088 | p04030 | C++ | #include "bits/stdc++.h"
using namespace std;
int main() {
string s, a='';
cin >> s;
for(int i=0;i<s.size();i++) {
if(s.at(i) == '0') a += '0';
if(s.at(i) == '1') a += '1';
if(s.at(i) == 'B') a.pop_back();
}
cout << a << endl;
}
| a.cc:5:21: error: empty character constant
5 | string s, a='';
| ^~
a.cc: In function 'int main()':
a.cc:5:21: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
|
s601839587 | p04030 | C++ | include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
char com[10];
cin>>com;
int N;
N=strlen(com);
vector<int> str;
for(int i=0;i<N;i++){
if(com[i]==1) {str.push_back(1);}
else if(com[i]==0) {str.push_back(0);}
... | a.cc:1:1: error: 'include' does not name a type
1 | include <iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from a.cc:3:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __... |
s427357883 | p04030 | Java | import java.util.*;
public class Keyboard {
public static void main(String[] args) {
// TODO 自动生成的方法存根
Scanner sc=new Scanner(System.in);
String b=sc.nextLine();
String K ;
int j=0;
StringBuilder builder=new StringBuilder("");
for(int i=0;i<b.length();i++) {
K=b.substring(i,i+1);
if(K.equals("B")&... | Main.java:2: error: class Keyboard is public, should be declared in a file named Keyboard.java
public class Keyboard {
^
1 error
|
s312283883 | p04030 | Java | import java.util.*;
public class Keyboard {
public static void main(String[] args) {
// TODO 自动生成的方法存根
Scanner sc=new Scanner(System.in);
String b=sc.nextLine();
String K ;
int j=0;
StringBuilder builder=new StringBuilder("");
for(int i=0;i<b.length();i++) {
K=b.substring(i,i+1);
if(K.equals("B")&... | Main.java:2: error: class Keyboard is public, should be declared in a file named Keyboard.java
public class Keyboard {
^
1 error
|
s267286759 | p04030 | C++ | #include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
char s[105],ans[105];
int main()
{
gets(s);
int len=strlen(s),tot=0;
for(int i=0;i<len;i++)
{
if(s[i]=='0') ans[++tot]='0';
if(s[i]=='B'&&tot>0) tot--;
if(s[i]=='1') ans[++tot]='1';
}
for(int i=1;i<=tot;i++)
{
cout<<ans[i];
}
re... | a.cc: In function 'int main()':
a.cc:8:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
8 | gets(s);
| ^~~~
| getw
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.