submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s145600898
|
p04030
|
C++
|
#include<iostream>
#include<cstring>
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];
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
7 | gets(s);
| ^~~~
| getw
|
s557728874
|
p04030
|
C++
|
#include<cstdio>
#include<cmath>
#include<iostream>
typedef long long ll;
using namespace std;
char a[100000];
int main()
{
int n,i;
scanf("%s",a);
n = strlen(a);
for(i = 0; i < n ; i++)
{
if(a[i] == '0')
printf("0");
else if(a[i] == '1')
printf("1");
else
printf("\b");
}
printf("\n");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:13: error: 'strlen' was not declared in this scope
12 | n = strlen(a);
| ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<iostream>
+++ |+#include <cstring>
4 | typedef long long ll;
|
s190370064
|
p04030
|
C++
|
knight 2018/9/29 22:18:56
#include<stdio.h>
#include<stdlib.h>
#include<cstring>
int main()
{
char s[100],ss[100];
int i=0,j=0,a=0;
int b[100];
for(i = 0 ; i < 10 ; i++)b[i] = 1;
scanf("%s",s);
a = strlen(s);
for(i=0;i<a;i++)
{
if(s[i]=='B')
{
b[i]=0;
for(j = i; j >=0 ;j--)
{
if(b[j]!=0)
{
b[j]=0;
break;
}
}
}
}
j = 0;
for(i=0;i<a;i++)
{
if(b[i]==1){
ss[j]=s[i];
j++;
}
}
ss[j] = 0;
printf("%s\n", ss);
return 1;
}
|
a.cc:2:1: error: 'knight' does not name a type
2 | knight 2018/9/29 22:18:56
| ^~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/stdlib.h:36,
from a.cc:4:
/usr/include/stdlib.h:98:8: error: 'size_t' does not name a type
98 | extern size_t __ctype_get_mb_cur_max (void) __THROW __wur;
| ^~~~~~
/usr/include/stdlib.h:42:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
41 | # include <bits/waitstatus.h>
+++ |+#include <cstddef>
42 |
/usr/include/stdlib.h:278:36: error: 'size_t' has not been declared
278 | extern int strfromd (char *__dest, size_t __size, const char *__format,
| ^~~~~~
/usr/include/stdlib.h:282:36: error: 'size_t' has not been declared
282 | extern int strfromf (char *__dest, size_t __size, const char *__format,
| ^~~~~~
/usr/include/stdlib.h:286:36: error: 'size_t' has not been declared
286 | extern int strfroml (char *__dest, size_t __size, const char *__format,
| ^~~~~~
/usr/include/stdlib.h:298:38: error: 'size_t' has not been declared
298 | extern int strfromf32 (char *__dest, size_t __size, const char * __format,
| ^~~~~~
/usr/include/stdlib.h:304:38: error: 'size_t' has not been declared
304 | extern int strfromf64 (char *__dest, size_t __size, const char * __format,
| ^~~~~~
/usr/include/stdlib.h:310:39: error: 'size_t' has not been declared
310 | extern int strfromf128 (char *__dest, size_t __size, const char * __format,
| ^~~~~~
/usr/include/stdlib.h:316:39: error: 'size_t' has not been declared
316 | extern int strfromf32x (char *__dest, size_t __size, const char * __format,
| ^~~~~~
/usr/include/stdlib.h:322:39: error: 'size_t' has not been declared
322 | extern int strfromf64x (char *__dest, size_t __size, const char * __format,
| ^~~~~~
In file included from /usr/include/stdlib.h:514:
/usr/include/x86_64-linux-gnu/sys/types.h:33:9: error: '__u_char' does not name a type
33 | typedef __u_char u_char;
| ^~~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:34:9: error: '__u_short' does not name a type
34 | typedef __u_short u_short;
| ^~~~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:35:9: error: '__u_int' does not name a type
35 | typedef __u_int u_int;
| ^~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:36:9: error: '__u_long' does not name a type
36 | typedef __u_long u_long;
| ^~~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:37:9: error: '__quad_t' does not name a type
37 | typedef __quad_t quad_t;
| ^~~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:38:9: error: '__u_quad_t' does not name a type
38 | typedef __u_quad_t u_quad_t;
| ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:39:9: error: '__fsid_t' does not name a type
39 | typedef __fsid_t fsid_t;
| ^~~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:42:9: error: '__loff_t' does not name a type; did you mean '__locale_t'?
42 | typedef __loff_t loff_t;
| ^~~~~~~~
| __locale_t
/usr/include/x86_64-linux-gnu/sys/types.h:47:9: error: '__ino_t' does not name a type
47 | typedef __ino_t ino_t;
| ^~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:54:9: error: '__ino64_t' does not name a type
54 | typedef __ino64_t ino64_t;
| ^~~~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:59:9: error: '__dev_t' does not name a type
59 | typedef __dev_t dev_t;
| ^~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:64:9: error: '__gid_t' does not name a type
64 | typedef __gid_t gid_t;
| ^~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:69:9: error: '__mode_t' does not name a type; did you mean '__locale_t'?
69 | typedef __mode_t mode_t;
| ^~~~~~~~
| __locale_t
/usr/include/x86_64-linux-gnu/sys/types.h:74:9: error: '__nlink_t' does not name a type
74 | typedef __nlink_t nlink_t;
| ^~~~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:79:9: error: '__uid_t' does not name a type
79 | typedef __uid_t uid_t;
| ^~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:97:9: error: '__pid_t' does not name a type
97 | typedef __pid_t pid_t;
| ^~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:103:9: error: '__id_t' does not name a type
103 | typedef __id_t id_t;
| ^~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:114:9: error: '__daddr_t' does not name a type
114 | typedef __daddr_t daddr_t;
| ^~~~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:115:9: error: '__caddr_t' does not name a type
115 | typedef __caddr_t caddr_t;
| ^~~~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:121:9: error: '__key_t' does not name a type
121 | typedef __key_t key_t;
| ^~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:126:
/usr/include/x86_64-linux-gnu/bits/types/clock_t.h:7:9: error: '__clock_t' does not name a type
7 | typedef __clock_t clock_t;
| ^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:128:
/usr/include/x86_64-linux-gnu/bits/types/clockid_t.h:7:9: error: '__clockid_t' does not name a type
7 | typedef __clockid_t clockid_t;
| ^~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:129:
/usr/include/x86_64-linux-gnu/bits/types/time_t.h:10:9: error: '__time_t' does not name a type
10 | typedef __time_t time_t;
| ^~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:130:
/usr/include/x86_64-linux-gnu/bits/types/timer_t.h:7:9: error: '__timer_t' does not name a type
7 | typedef __timer_t timer_t;
| ^~~~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:134:9: error: '__useconds_t' does not name a type
134 | typedef __useconds_t useconds_t;
| ^~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/sys/types.h:138:9: error: '__suseconds_t' does not name a type
138 | typedef __suseconds_t suseconds_t;
| ^~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:155:
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:24:9: error: '__int8_t' does not name a type; did you mean '__int128_t'?
24 | typedef __int8_t int8_t;
| ^~~~~~~~
| __int128_t
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:25:9: error: '__int16_t' does not name a type; did you mean '__int128_t'?
25 | typedef __int16_t int16_t;
| ^~~~~~~~~
| __int128_t
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:26:9: error: '__int32_t' does not name a type; did you mean '__int128_t'?
26 | typedef __int32_t int32_t;
| ^~~~~~~~~
| __int128_t
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:27:9: error: '__int64_t' does not name a type; did you mean '__int128_t'?
27 | typedef __int64_t int64_t;
| ^~~~~~~~~
| __int128_t
/usr/include/x86_64-linux-gnu/sys/types.h:158:9: error: '__uint8_t' does not name a type; did you mean '__uint128_t'?
158 | typedef __uint8_t u_int8_t;
| ^~~~~~~~~
| __uint128_t
/usr/include/x86_64-linux-gnu/sys/types.h:159:9: error: '__uint16_t' does not name a type; did you mean '__uint128_t'?
159 | typedef __uint16_t u_int16_t;
| ^~~~~~~~~~
| __uint128_t
/usr/include/x86_64-linux-gnu/sys/types.h:160:9: error: '__uint32_t' does not name a type; did you mean '__uint128_t'?
160 | typedef __uint32_t u_int32_t;
| ^~~~~~~~~~
| __uint128_t
/usr/include/x86_64-linux-gnu/sys/types.h:161:9: error: '__uint64_t' does not name a type; did you mean '__uint128_t'?
161 | typedef __uint64_t u_int64_t;
| ^~~~~~~~~~
| __uint128_t
In file included from /usr/include/endian.h:35,
from /usr/include/x86_64-linux-gnu/sys/types.h:176:
/usr/include/x86_64-linux-gnu/bits/byteswap.h:33:17: error: '__uint16_t' does not name a type; did you mean '__uint128_t'?
33 | static __inline __uint16_t
| ^~~~~~~~~~
| __uint128_t
/usr/include/x86_64-linux-gnu/bits/byteswap.h:48:17: error: '__uint32_t' does not name a type; did you mean '__uint128_t'?
48 | static __inline __uint32_t
| ^~~~~~~~~~
| __uint128_t
/usr/include/x86_64-linux-gnu/bits/byteswap.h:69:31: error: '__uint64_t' does not name a type; did you mean '__uint128_t'?
69 | __extension__ static __inline __uint64_t
| ^~~~~~~~~~
| __uint128_t
In file included from /usr/include/endian.h:36:
/usr/include/x86_64-linux-gnu/bits/uintn-identity.h:32:17: error: '__uint16_t' does not name a type; did you mean '__uint128_t'?
32 | static __inline __uint16_t
| ^~~~~~~~~~
| __uint128_t
/usr/include/x86_64-linux-gnu/bits/uintn-identity.h:38:17: error: '__uint32_t' does not name a type; did you mean '__uint128_t'?
38 | static __inline __uint32_t
| ^~~~~~~~~~
| __uint128_t
/usr/include/x86_64-linux-gnu/bits/uintn-identity.h:44:17: error: '__uint64_t' does not name a type; did you mean '__uint128_t'?
44 | static __inline __uint64_t
| ^~~~~~~~~~
| __uint128_t
In file included from /usr/include/x86_64-linux-gnu/sys/select.h:37,
from /usr/include/x86_64-linux-gnu/sys/types.h:179:
/usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h:14:3: error: '__time_t' does not name a type; did you mean '__sigset_t'?
14 | __time_t tv_sec; /* Seconds. */
| ^~~~~~~~
| __sigset_t
/usr/include/x86_64-
|
s692460159
|
p04030
|
C
|
*s,c;char*p=s+3,*q=s+3;main(){for(gets(s);p-->s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
|
main.c:1:1: warning: data definition has no type or storage class
1 | *s,c;char*p=s+3,*q=s+3;main(){for(gets(s);p-->s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ^
main.c:1:2: error: type defaults to 'int' in declaration of 's' [-Wimplicit-int]
1 | *s,c;char*p=s+3,*q=s+3;main(){for(gets(s);p-->s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ^
main.c:1:4: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
1 | *s,c;char*p=s+3,*q=s+3;main(){for(gets(s);p-->s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ^
main.c:1:13: error: initialization of 'char *' from incompatible pointer type 'int *' [-Wincompatible-pointer-types]
1 | *s,c;char*p=s+3,*q=s+3;main(){for(gets(s);p-->s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ^
main.c:1:13: error: initializer element is not constant
main.c:1:20: error: initialization of 'char *' from incompatible pointer type 'int *' [-Wincompatible-pointer-types]
1 | *s,c;char*p=s+3,*q=s+3;main(){for(gets(s);p-->s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ^
main.c:1:20: error: initializer element is not constant
main.c:1:24: error: return type defaults to 'int' [-Wimplicit-int]
1 | *s,c;char*p=s+3,*q=s+3;main(){for(gets(s);p-->s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ^~~~
main.c: In function 'main':
main.c:1:35: error: implicit declaration of function 'gets' [-Wimplicit-function-declaration]
1 | *s,c;char*p=s+3,*q=s+3;main(){for(gets(s);p-->s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ^~~~
main.c:1:46: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
1 | *s,c;char*p=s+3,*q=s+3;main(){for(gets(s);p-->s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ^
main.c:1:75: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
1 | *s,c;char*p=s+3,*q=s+3;main(){for(gets(s);p-->s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ^~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'puts'
+++ |+#include <stdio.h>
1 | *s,c;char*p=s+3,*q=s+3;main(){for(gets(s);p-->s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
|
s933497060
|
p04030
|
C
|
s[9];char*p=s+3,*q=s+3;c;main(){for(gets(s);p---s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
|
main.c:1:1: warning: data definition has no type or storage class
1 | s[9];char*p=s+3,*q=s+3;c;main(){for(gets(s);p---s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 's' [-Wimplicit-int]
main.c:1:13: error: initialization of 'char *' from incompatible pointer type 'int *' [-Wincompatible-pointer-types]
1 | s[9];char*p=s+3,*q=s+3;c;main(){for(gets(s);p---s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ^
main.c:1:20: error: initialization of 'char *' from incompatible pointer type 'int *' [-Wincompatible-pointer-types]
1 | s[9];char*p=s+3,*q=s+3;c;main(){for(gets(s);p---s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ^
main.c:1:24: warning: data definition has no type or storage class
1 | s[9];char*p=s+3,*q=s+3;c;main(){for(gets(s);p---s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ^
main.c:1:24: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
main.c:1:26: error: return type defaults to 'int' [-Wimplicit-int]
1 | s[9];char*p=s+3,*q=s+3;c;main(){for(gets(s);p---s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ^~~~
main.c: In function 'main':
main.c:1:37: error: implicit declaration of function 'gets' [-Wimplicit-function-declaration]
1 | s[9];char*p=s+3,*q=s+3;c;main(){for(gets(s);p---s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ^~~~
main.c:1:48: error: invalid operands to binary - (have 'char *' and 'int *')
1 | s[9];char*p=s+3,*q=s+3;c;main(){for(gets(s);p---s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ~~~^
| | |
| | int *
| char *
main.c:1:77: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
1 | s[9];char*p=s+3,*q=s+3;c;main(){for(gets(s);p---s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
| ^~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'puts'
+++ |+#include <stdio.h>
1 | s[9];char*p=s+3,*q=s+3;c;main(){for(gets(s);p---s;)*p-66?!c?*--q=*p:c--:c++;puts(q);}
|
s124647721
|
p04030
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
string t;
t="";
for(int i=0;i<s.size();i++)P{
if(s[i]=='1') t+='1';
else if(s[i]=='0') t+='0';
else if(t.size()>0) t.erase(t.end()-1);
}
cout<<t;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:8:36: error: 'P' was not declared in this scope
8 | for(int i=0;i<s.size();i++)P{
| ^
|
s558970807
|
p04030
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
string
t="";
for(int i=0;i<s.size();i++)P{
if(s[i]=='1') t+='1';
else if(s[i]=='0') t+='0';
else if(t.size()>0) t.erase(t.end()-1);
}
cout<<t;
}
|
a.cc: In function 'int main()':
a.cc:8:36: error: 'P' was not declared in this scope
8 | for(int i=0;i<s.size();i++)P{
| ^
|
s433307666
|
p04030
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
strint t="";
for(int i=0;i<s.size();i++)P{
if(s[i]=='1') t+='1';
else if(s[i]=='0') t+='0';
else if(t.size()>0) t.erase(t.end()-1);
}
cout<<t;
}
|
a.cc: In function 'int main()':
a.cc:6:9: error: 'strint' was not declared in this scope; did you mean 'strcat'?
6 | strint t="";
| ^~~~~~
| strcat
a.cc:7:36: error: 'P' was not declared in this scope
7 | for(int i=0;i<s.size();i++)P{
| ^
a.cc:12:15: error: 't' was not declared in this scope
12 | cout<<t;
| ^
|
s027060171
|
p04030
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main()
{
int i,pos,a;
string s;
cin>>s;
for(i=1;i<=s.size();i++)
{
if(s[1]=='B')
{
a.erase('B',2)
}
if(s[1]==0)
{
a+=0;
}
else
{
a+=1;
}
}
cout<<a;
}
|
a.cc: In function 'int main()':
a.cc:12:27: error: request for member 'erase' in 'a', which is of non-class type 'int'
12 | a.erase('B',2)
| ^~~~~
|
s321878738
|
p04030
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main()
{
int i,s,pos,a;
cin>>s;
for(i=1;i<=s.size();i++)
{
if(s[1]=='B')
{
a.erase('B',2)
}
if(s[1]==0)
{
a+=0;
}
else
{
a+=1;
}
}
cout<<a;
}
|
a.cc: In function 'int main()':
a.cc:7:22: error: request for member 'size' in 's', which is of non-class type 'int'
7 | for(i=1;i<=s.size();i++)
| ^~~~
a.cc:9:21: error: invalid types 'int[int]' for array subscript
9 | if(s[1]=='B')
| ^
a.cc:11:27: error: request for member 'erase' in 'a', which is of non-class type 'int'
11 | a.erase('B',2)
| ^~~~~
a.cc:13:21: error: invalid types 'int[int]' for array subscript
13 | if(s[1]==0)
| ^
|
s582158620
|
p04030
|
C++
|
#include <iostream>
#include <algorithm>
#include <stack>
using namespace std;
int main(){
string a;
stack<string>s;
cin>>a;
for(int i=0;i<a.size();i++){
if(a[i]=='0'){s.push('0');}
else if(a[i]=='1'){s.push('1');}
else{s.pop();}
}
cout<<s<<endl;
}
|
a.cc: In function 'int main()':
a.cc:10:33: error: no matching function for call to 'std::stack<std::__cxx11::basic_string<char> >::push(char)'
10 | if(a[i]=='0'){s.push('0');}
| ~~~~~~^~~~~
In file included from /usr/include/c++/14/stack:63,
from a.cc:3:
/usr/include/c++/14/bits/stl_stack.h:258:7: note: candidate: 'void std::stack<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Sequence = std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >; value_type = std::__cxx11::basic_string<char>]'
258 | push(const value_type& __x)
| ^~~~
/usr/include/c++/14/bits/stl_stack.h:258:30: note: no known conversion for argument 1 from 'char' to 'const std::stack<std::__cxx11::basic_string<char> >::value_type&' {aka 'const std::__cxx11::basic_string<char>&'}
258 | push(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_stack.h:263:7: note: candidate: 'void std::stack<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::__cxx11::basic_string<char>; _Sequence = std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >; value_type = std::__cxx11::basic_string<char>]'
263 | push(value_type&& __x)
| ^~~~
/usr/include/c++/14/bits/stl_stack.h:263:25: note: no known conversion for argument 1 from 'char' to 'std::stack<std::__cxx11::basic_string<char> >::value_type&&' {aka 'std::__cxx11::basic_string<char>&&'}
263 | push(value_type&& __x)
| ~~~~~~~~~~~~~^~~
a.cc:11:38: error: no matching function for call to 'std::stack<std::__cxx11::basic_string<char> >::push(char)'
11 | else if(a[i]=='1'){s.push('1');}
| ~~~~~~^~~~~
/usr/include/c++/14/bits/stl_stack.h:258:7: note: candidate: 'void std::stack<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Sequence = std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >; value_type = std::__cxx11::basic_string<char>]'
258 | push(const value_type& __x)
| ^~~~
/usr/include/c++/14/bits/stl_stack.h:258:30: note: no known conversion for argument 1 from 'char' to 'const std::stack<std::__cxx11::basic_string<char> >::value_type&' {aka 'const std::__cxx11::basic_string<char>&'}
258 | push(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_stack.h:263:7: note: candidate: 'void std::stack<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::__cxx11::basic_string<char>; _Sequence = std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >; value_type = std::__cxx11::basic_string<char>]'
263 | push(value_type&& __x)
| ^~~~
/usr/include/c++/14/bits/stl_stack.h:263:25: note: no known conversion for argument 1 from 'char' to 'std::stack<std::__cxx11::basic_string<char> >::value_type&&' {aka 'std::__cxx11::basic_string<char>&&'}
263 | push(value_type&& __x)
| ~~~~~~~~~~~~~^~~
a.cc:14:13: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::stack<std::__cxx11::basic_string<char> >')
14 | cout<<s<<endl;
| ~~~~^~~
| | |
| | std::stack<std::__cxx11::basic_string<char> >
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::stack<std::__cxx11::basic_string<char> >' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::stack<std::__cxx11::basic_string<char> >' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::stack<std::__cxx11::basic_string<char> >' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::stack<std::__cxx11::basic_string<char> >' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::stack<std::__cxx11::basic_string<char> >' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::stack<std::__cxx11::basic_string<char> >' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::stack<std::__cxx11::basic_string<char> >' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::stack<std::__cxx11::basic_string<char> >' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::stack<std::__cxx11::basic_string<char> >' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::stack<std::__cxx11::basic_string<char> >' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::stack<std::_
|
s693263431
|
p04030
|
C++
|
#include <iostream>
#include <string>
int main() {
std::string s;
std::cin >> s;
std::string str = "";
for (int i = 0; i < n; ++i) {
if ( s[i] == 'B' && str.length() > 0 ) {
str.erase(str.length() - 1);
} else if ( s[i] != 'B' ) {
str += s[i];
}
}
std::cout << str << std::endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:9:23: error: 'n' was not declared in this scope
9 | for (int i = 0; i < n; ++i) {
| ^
|
s729106064
|
p04030
|
C++
|
/*
|\_/|
|* *|
\_+_/
*/
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
int main(){
cin.tie(0); // cout と cin の同期を切る
ios::sync_with_stdio(false); /* cの stdioストリーム (printfとか)と*/
stack <int > st;
queue<int>st2;
string str;
cin>>str;
for(int i=0;i<str.length();i++){
if(str[i]=='B'){
if(st.size()){
st.pop();
}
}
else{
if(str[i]=='1'){
st.push(1);
}else{
st.push(0);
}
}
}
while(st.size()){
st2.push(st.top());
st.pop();
}
while(st2.size()){
cout<<st2.top();
st2.pop();
}
cout<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:54:15: error: 'class std::queue<int>' has no member named 'top'; did you mean 'pop'?
54 | cout<<st2.top();
| ^~~
| pop
|
s737039914
|
p04030
|
C++
|
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <string.h>
#include <cstdio>
using namespace std;
void deleteAllMark(string &s, const string &mark)
{
size_t nSize = mark.size();
while(1)
{
size_t pos = s.find(mark);
if(pos == string::npos)
{
return;
}
s.erase(pos, nSize);
}
}
int main(void)
{
string input;
cin >> input;
//cout << input[input.length()-1] << endl;
string screen="";
for(int i=0;i<input.length();i++)
{
if(input[i]=='B')
{
deleteAllMark(screen," ");
screen[screen.length()-1]=' ';
deleteAllMark(screen," ");
//cout << screen << endl;
}
else
{
screen+=input[i];
//cout << screen << endl;
}
}
cout << screen << endl;
|
a.cc: In function 'int main()':
a.cc:42:28: error: expected '}' at end of input
42 | cout << screen << endl;
| ^
a.cc:22:1: note: to match this '{'
22 | {
| ^
|
s095747979
|
p04030
|
C
|
#include<stdio.h>
#include<string.h>
int main(){
char s[11];
int flag[10]={};
scanf("%s",s);
for(int i=0;i<strlen(s);i++){
if(s[i]!='B')
flad[i]=1;
else{
for(int j=i-1;j>=0;j--){
if(flag[j]==1){
flag[j]=0;
break;
}
}
}
}
for(int i=0;i<strlen(s);i++)
if(flag[i])
printf("%c",s[i]);
printf("\n");
}
|
main.c: In function 'main':
main.c:9:7: error: 'flad' undeclared (first use in this function); did you mean 'flag'?
9 | flad[i]=1;
| ^~~~
| flag
main.c:9:7: note: each undeclared identifier is reported only once for each function it appears in
|
s390465866
|
p04030
|
C
|
#include<stdio.h>
#include<string.h>
int main(){
char s[11];
flag[10]={};
scanf("%s",s);
for(int i=0;i<strlen(s);i++){
if(s[i]!='B')
flad[i]=1;
else{
for(int j=i-1;j>=0;j--){
if(flag[j]==1){
flag[j]=0;
break;
}
}
}
}
for(int i=0;i<strlen(s);i++)
if(flag[i])
printf("%c",s[i]);
printf("\n");
}
|
main.c: In function 'main':
main.c:5:3: error: 'flag' undeclared (first use in this function)
5 | flag[10]={};
| ^~~~
main.c:5:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:12: error: expected expression before '{' token
5 | flag[10]={};
| ^
main.c:9:7: error: 'flad' undeclared (first use in this function)
9 | flad[i]=1;
| ^~~~
|
s763305701
|
p04030
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
string s="",command;
cin>>command;
for(int i=0;i<command.size();i++){
switch(command[i]){
case '0':
s+='0';
break;
case '1':
s+='1';
break;
case 'B':
if(s.size()!=0){
s-=s[s.size()-1];
}
break;
}
}
cout<<s<<endl;
}
|
a.cc: In function 'int main()':
a.cc:17:12: 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'})
17 | s-=s[s.size()-1];
|
s788557786
|
p04030
|
C
|
#include <stdio.h>
#include <string.h>
int main(void){
char s[11],c[11];
int i,j=0;
scanf("%s",s);
for(i=0;i<strlen(s);i++){
if(s[i]!='B') c[j++]=s[i];
else{
if(j>0) c[--j]='\0';
else c[j]='\0';
}
c[j]='\0';
printf("%s",c);
return 0;
}
|
main.c: In function 'main':
main.c:16:1: error: expected declaration or statement at end of input
16 | }
| ^
|
s957716296
|
p04030
|
C
|
#include <stdio.h>
#include <string.h>
int main(void){
char s[11],c[11];
int i,j=0;
scanf("%s",s);
for(i=0;i<strlen(s);i++){
if(s[i]!='B') c[j++]=s[i];
else j>0?c[--j]='\0':c[j]='\0';
}
c[j]='\0';
printf("%s",c);
return 0;
}
|
main.c: In function 'main':
main.c:9:28: error: lvalue required as left operand of assignment
9 | else j>0?c[--j]='\0':c[j]='\0';
| ^
|
s452776992
|
p04030
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
char c;
while(cin>>c){
if(c-'B'){
s+=c;
}else if(s!=""){
s.pop_back;
}
cout<<s<<endl;
}
}
|
a.cc: In function 'int main()':
a.cc:11:9: 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>]'
11 | s.pop_back;
| ~~^~~~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:2174:7: note: declared here
2174 | pop_back() noexcept
| ^~~~~~~~
|
s374089014
|
p04030
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
# define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
# define DBG(fmt, ...)
#endif
const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 30
signed main()
{
string S;
cin >> S;
vetor<int> ans;
REP(i, S.length()) {
if(S[i] == '1') { ans.push_back(1); }
else if(S[i] == '0') { ans.push_back(0); }
else if(ans.size() > 0) { ans.pop_back(); }
}
REP(i, ans.size()) {
printf("%lld", ans[i]);
}
printf("\n");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:27:5: error: 'vetor' was not declared in this scope
27 | vetor<int> ans;
| ^~~~~
a.cc:27:14: error: expected primary-expression before '>' token
27 | vetor<int> ans;
| ^
a.cc:27:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
27 | vetor<int> ans;
| ^~~
| abs
|
s463605559
|
p04030
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
// {{{
template<typename T>
void printmatrix(vector<vector<T> > ar){
for (int i = 0; i < (int)ar.size(); i++) {
for (int j = 0; j < (int)ar[0].size(); j++) {
cout << ar[i][j];
}
cout << endl;
}
}
template<typename T>
void printvector(vector<T> vec){
for (int i = 0; i < (int)vec.size(); i++) {
cout << vec[i] << endl;
}
}
template<typename T>
void unique(vector<T>& vec){
sort(vec.begin(), vec.end());
vec.erase(unique(vec.begin(), vec.end()), vec.end());
}
template<typename T>
vector<T> cumsum(vector<T> vec){
vector<T> newvec((T)vec.size());
int tmp = 0;
for (int i = 0; i < (int)vec.size(); i++) {
tmp += vec[i];
newvec[i] = tmp;
}
return newvec;
}
template<typename T>
T digitsum(T x){
T y=0;
while(x){
y += x % 10;
x /= 10;
}
return y;
}
template<typename T>
T gcd(T x, T y){
if (x == 0 || y == 0) {
return 0;
}
while (x != y){
if (x > y) {
x -= y;
}else{
y -= x;
}
}
return x;
}
// }}}
/* vim:set foldmethod=marker: */
void solve(){
string s;
cin >> s;
string ans="";
for (int i = s.length()-1; i >= 0; i--) {
// cout << i << endl;
if (s[i] != 'B') {
// cout << i << endl;
ans = s[i] + ans;
}else{
if (i >= 1 && s[i] == 'B') {
i-=2;
}else{
i--;
}
}
}
cout << ans << endl;
return;
}
int main(int argc, char const* argv[])
{
solve();
return 0;
}
// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector 昇順
// sort(v.begin(), v.end(), greater<int>()); // 降順
// Template
// template <class T>
// T foomax(T x, T y){
// if (x > y){
// return x;
// }else{
// return y;
// }
// }
// string を int に変換 stoi("1010")
// int を string に変換 to_string(1010)
// map の key, value を全て抜き出す。
// for (auto itr = mp.begin(); itr != mp.end(); itr++) {
// cout << "key" << itr->first << " value" << itr->second << endl;
/
|
a.cc:132:1: error: expected unqualified-id before '/' token
132 | /
| ^
|
s683213862
|
p04030
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
int s=S.size();
for(int i=0;i<s;i++){
|
a.cc: In function 'int main()':
a.cc:8:24: error: expected '}' at end of input
8 | for(int i=0;i<s;i++){
| ~^
a.cc:8:24: error: expected '}' at end of input
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s413727981
|
p04030
|
Java
|
import java.util.*;
public class Main {
public static void main(String[] args) {
// 自分の得意な言語で
// Let's チャレンジ!!
ArrayList<String> in=new ArrayList<String>();
Scanner sc = new Scanner(System.in);
String line = sc.nextLine();
String s[]=line.split("",0);
for(int i=0;i<s.length;i++){
if(s[i].equals("1"))
in.add("1");
if(s[i].equals("0"))
in.add("0");
if(s[i].equals("B")&&in.size()!=0)
in.remove(in.size()-1);
}
for(int i=0;i<in.size();i++)
System.out.print(in.get(i));
}
System.out.println();
}
|
Main.java:25: error: <identifier> expected
System.out.println();
^
1 error
|
s638083141
|
p04030
|
C++
|
S = input()
#print(S)
ans = []
for str in S:
if str == '0':
ans.append('0')
elif str == '1':
ans.append('1')
else:
if len(ans) > 0:
ans.pop()
for a in ans:
print(a,end ="")
print()
|
a.cc:3:2: error: invalid preprocessing directive #print
3 | #print(S)
| ^~~~~
a.cc:1:1: error: 'S' does not name a type
1 | S = input()
| ^
|
s664984816
|
p04030
|
C++
|
#include<iostream>
using namespace std;
int main(){
string ans,s;
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' && s[i] != "")
ans.pop_back();
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:13:45: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
13 | else if(s[i] == 'B' && s[i] != "")
|
s831502764
|
p04030
|
C++
|
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
string s;
cin >> s;
vector<char> v;
int n = s.size();
for (int i = 0;i < n;i++) {
if (s[i] == '0')v.push_back('0');
else if (s[i] == '1')v.push_back('1');
else v.pop_back();
}
int m = v.size();
for (int i = 0;i < m;i++)cout << v[i];
}
|
a.cc:7:9: error: extended character is not valid in an identifier
7 | string s;
| ^
a.cc: In function 'int main()':
a.cc:7:9: error: 'string\U00003000s' was not declared in this scope
7 | string s;
| ^~~~~~~~~
a.cc:8:16: error: 's' was not declared in this scope
8 | cin >> s;
| ^
|
s291510966
|
p04030
|
C++
|
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
string
cin >> s;
vector<char> v;
int n = s.size();
for (int i = 0;i < n;i++) {
if (s[i] == '0')v.push_back('0');
else if (s[i] == '1')v.push_back('1');
else v.pop_back();
}
int m = v.size();
for (int i = 0;i < m;i++)cout << v[i];
}
|
a.cc: In function 'int main()':
a.cc:8:13: error: expected initializer before '>>' token
8 | cin >> s;
| ^~
a.cc:10:17: error: 's' was not declared in this scope
10 | int n = s.size();
| ^
|
s023315314
|
p04030
|
C++
|
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
string
cin >> s;
vector<char> v;
int n = s.size();
for (int i = 0;i < n;i++) {
if (s[i] == '0')v.push_back('0');
else if (s[i] == '1')v.push_back('1');
else v.pop_back();
}
int m = v.size();
for (int i = 0;i < m;i++)cout << v[i];
}
|
a.cc: In function 'int main()':
a.cc:8:13: error: expected initializer before '>>' token
8 | cin >> s;
| ^~
a.cc:10:17: error: 's' was not declared in this scope
10 | int n = s.size();
| ^
|
s525031056
|
p04030
|
C++
|
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
string s;
cin >> s;
vector<char> v;
int n = s.size();
for (int i = 0;i < n;i++) {
if (s[i] == '0')v.push_back('0');
else if (s[i] == '1')v.push_back('1');
else v.pop_back;
}
int m = v.size();
for (int i = 0;i < m;i++)cout << v[i];
}
|
a.cc: In function 'int main()':
a.cc:14:24: error: invalid use of non-static member function 'void std::vector<_Tp, _Alloc>::pop_back() [with _Tp = char; _Alloc = std::allocator<char>]'
14 | else v.pop_back;
| ~~^~~~~~~~
In file included from /usr/include/c++/14/vector:66,
from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:1324:7: note: declared here
1324 | pop_back() _GLIBCXX_NOEXCEPT
| ^~~~~~~~
|
s028067671
|
p04030
|
C++
|
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
string s;
cin >> s;
vector<char> v;
int n = s.size();
for (int i = 0;i < n;i++) {
if (s[i] == '0')v.push_back('0');
else if (s[i] == '1')v.push_back('1');
else v.pop_back;
}
int m = v.size();
for (int i = ;i < m;i++)cout << v[i];
}
|
a.cc: In function 'int main()':
a.cc:14:24: error: invalid use of non-static member function 'void std::vector<_Tp, _Alloc>::pop_back() [with _Tp = char; _Alloc = std::allocator<char>]'
14 | else v.pop_back;
| ~~^~~~~~~~
In file included from /usr/include/c++/14/vector:66,
from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:1324:7: note: declared here
1324 | pop_back() _GLIBCXX_NOEXCEPT
| ^~~~~~~~
a.cc:17:22: error: expected primary-expression before ';' token
17 | for (int i = ;i < m;i++)cout << v[i];
| ^
|
s942480232
|
p04030
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
string s;
cin >> s;
string ans = "";
for(char c : s){
if(c == '1' || c == '0'){
ans += c;
}else{
if(s.size()) ans = ans.substr(ans.size() - 1);
}
}
cout << ans < <endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:15:17: error: expected primary-expression before '<' token
15 | cout << ans < <endl;
| ^
|
s006300525
|
p04030
|
C++
|
a#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384
std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
string s;
for (int i = 0; i<tgt.size(); i++) {
s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
}
out << s;
return out;
}
int main() {
string s,ans;
cin >> s;
rep(i, s.size()) {
if (s[i] == 'B') {
if (ans.size()) {
ans.pop_back();
}
}
else ans.push_back(s[i]);
}
cout << ans << endl;
}
|
a.cc:1:2: error: stray '#' in program
1 | a#include <bits/stdc++.h>
| ^
a.cc:1:1: error: 'a' does not name a type
1 | a#include <bits/stdc++.h>
| ^
a.cc:4:12: error: 'vector' does not name a type
4 | using vi = vector<int>;
| ^~~~~~
a.cc:5:13: error: 'vector' does not name a type
5 | using vvi = vector<vi>;
| ^~~~~~
a.cc:6:12: error: 'vector' does not name a type
6 | using vs = vector<string>;
| ^~~~~~
a.cc:7:13: error: 'map' does not name a type; did you mean 'mp'?
7 | using msi = map<string, int>;
| ^~~
| mp
a.cc:8:13: error: 'map' does not name a type; did you mean 'mp'?
8 | using mii = map<int, int>;
| ^~~
| mp
a.cc:9:13: error: 'pair' does not name a type
9 | using psi = pair<string, int>;
| ^~~~
a.cc:10:13: error: 'pair' does not name a type
10 | using pii = pair<int, int>;
| ^~~~
a.cc:11:14: error: 'valarray' does not name a type
11 | using vlai = valarray<int>;
| ^~~~~~~~
a.cc:26:6: error: 'ostream' in namespace 'std' does not name a type
26 | std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
| ^~~~~~~
a.cc:1:1: note: 'std::ostream' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | a#include <bits/stdc++.h>
a.cc: In function 'int main()':
a.cc:37:9: error: 'string' was not declared in this scope
37 | string s,ans;
| ^~~~~~
a.cc:38:9: error: 'cin' was not declared in this scope
38 | cin >> s;
| ^~~
a.cc:38:16: error: 's' was not declared in this scope; did you mean 'sc'?
38 | cin >> s;
| ^
| sc
a.cc:41:29: error: 'ans' was not declared in this scope
41 | if (ans.size()) {
| ^~~
a.cc:45:22: error: 'ans' was not declared in this scope
45 | else ans.push_back(s[i]);
| ^~~
a.cc:47:9: error: 'cout' was not declared in this scope
47 | cout << ans << endl;
| ^~~~
a.cc:47:17: error: 'ans' was not declared in this scope
47 | cout << ans << endl;
| ^~~
a.cc:47:24: error: 'endl' was not declared in this scope
47 | cout << ans << endl;
| ^~~~
|
s206771885
|
p04030
|
C++
|
av
|
a.cc:1:1: error: 'av' does not name a type
1 | av
| ^~
|
s840065599
|
p04030
|
C
|
#include<stdio.h>
#include<string.h>
int main(void){
int i,p;
char sd[10] = "";
char f[20] = "";
char e[20];
scanf("%s",sd);
p = strlen(sd);
for (i = 0;i < p; i++) {
if (sd[i] == '0') {
strcat_s(f, "0");
}
if (sd[i] == '1') {
strcat_s(f, "1");
}
if (sd[i] == '2') {
strncpy_s(e, f, (int)(strlen(f) - 1));
strcpy_s(f, e);
}
}
printf("%s\n", f);
return 0;
}
|
main.c: In function 'main':
main.c:12:25: error: implicit declaration of function 'strcat_s'; did you mean 'strcat'? [-Wimplicit-function-declaration]
12 | strcat_s(f, "0");
| ^~~~~~~~
| strcat
main.c:18:21: error: implicit declaration of function 'strncpy_s'; did you mean 'strncpy'? [-Wimplicit-function-declaration]
18 | strncpy_s(e, f, (int)(strlen(f) - 1));
| ^~~~~~~~~
| strncpy
main.c:19:25: error: implicit declaration of function 'strcpy_s'; did you mean 'strcpy'? [-Wimplicit-function-declaration]
19 | strcpy_s(f, e);
| ^~~~~~~~
| strcpy
|
s723544904
|
p04030
|
C++
|
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main(void)
{
int i;
char S[11];
scanf("%s",S);
for (i = 0; S[i] != '\0'; i++)
{
if (S[i] == 'B')
{
printf("\b");
if (S[i + 1] == '\0')
printf(" ");
continue;
}
printf("%c",S[i]);
}
return 0;
|
a.cc: In function 'int main()':
a.cc:26:18: error: expected '}' at end of input
26 | return 0;
| ^
a.cc:5:1: note: to match this '{'
5 | {
| ^
|
s993587481
|
p04030
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) a.begin(),a.end()
int main(void){
string s;
cin>>s;
reverse(all(s));
int n = s.size();
int del = 0;
rep(i,n){
if(s[i]=='B'){
del++;
}else if(del>0){
s[i] = 'B';
de--;
}
}
reverse(all(s));
rep(i,n){
if(s[i]!='B')cout<<s[i];
}
cout<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:17:13: error: 'de' was not declared in this scope; did you mean 'del'?
17 | de--;
| ^~
| del
|
s226483190
|
p04030
|
C++
|
#include<stdio.h>
#include <string.h>
int main(){
char input[10], output[10];
scanf("%s", input);
int index = 0;
for(int i = 0; i <= strlen(input); i++){
if(strcmp(input[i], "0") == 0){
output[index] = "0";
}else if(strcmp(input[i], "1") == 0){
output[index] = "1";
}else if(strcmp(input[i], "B") == 0){
if(index > 0){
index--;
output[index] = NULL;
}
}
index++;
}
printf("%s", output);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:22: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
12 | if(strcmp(input[i], "0") == 0){
| ~~~~~~~^
| |
| char
In file included from a.cc:2:
/usr/include/string.h:156:32: note: initializing argument 1 of 'int strcmp(const char*, const char*)'
156 | extern int strcmp (const char *__s1, const char *__s2)
| ~~~~~~~~~~~~^~~~
a.cc:13:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
13 | output[index] = "0";
| ^~~
| |
| const char*
a.cc:14:28: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
14 | }else if(strcmp(input[i], "1") == 0){
| ~~~~~~~^
| |
| char
/usr/include/string.h:156:32: note: initializing argument 1 of 'int strcmp(const char*, const char*)'
156 | extern int strcmp (const char *__s1, const char *__s2)
| ~~~~~~~~~~~~^~~~
a.cc:15:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
15 | output[index] = "1";
| ^~~
| |
| const char*
a.cc:16:28: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
16 | }else if(strcmp(input[i], "B") == 0){
| ~~~~~~~^
| |
| char
/usr/include/string.h:156:32: note: initializing argument 1 of 'int strcmp(const char*, const char*)'
156 | extern int strcmp (const char *__s1, const char *__s2)
| ~~~~~~~~~~~~^~~~
a.cc:19:25: warning: converting to non-pointer type 'char' from NULL [-Wconversion-null]
19 | output[index] = NULL;
| ^~~~
|
s408701921
|
p04030
|
C++
|
#include<stdio.h>
#include <string.h>
int main(){
char input[10], output[10];
scanf("%s", input);
int index = 0;
for(int i = 0; i <= strlen(input); i++){
if(input[i] == "0"){
output[index] = "0";
}else if(input[i] == "1"){
output[index] = "0";
}else if(input[i] == "B"){
if(index > 0){
index--;
output[index] = NULL;
}
}
index++;
}
printf("%s", output);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
12 | if(input[i] == "0"){
| ~~~~~~~~~^~~~~~
a.cc:13:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
13 | output[index] = "0";
| ^~~
| |
| const char*
a.cc:14:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
14 | }else if(input[i] == "1"){
| ~~~~~~~~~^~~~~~
a.cc:15:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
15 | output[index] = "0";
| ^~~
| |
| const char*
a.cc:16:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
16 | }else if(input[i] == "B"){
| ~~~~~~~~~^~~~~~
a.cc:19:25: warning: converting to non-pointer type 'char' from NULL [-Wconversion-null]
19 | output[index] = NULL;
| ^~~~
|
s434910780
|
p04030
|
C++
|
#include<bits/stdc++.h>
using namespace std;
char a[1005];
char b[1005];
int p;
int main(){
gets(a);
for(int i=0;i<strlen(a);i++){
if(a[i]=='B'){
if(p>=1) p--;
}
else b[++p]=a[i];
}
for(int i=1;i<=p;i++) cout<<b[i];
cout<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
7 | gets(a);
| ^~~~
| getw
|
s000448256
|
p04030
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
string s="";
string ans="";
cin>>s;
for(int i=0;i<10;i++){
char temp=s[i];
if(temp=='0')ans.push_back('0');
if(temp=='1')ans.push_back('1');
if(temp=='B'&&!ans.empty())ans.pop_back();
if(temp=='')break;
}
cout<<ans<<endl;
}
|
a.cc:13:14: error: empty character constant
13 | if(temp=='')break;
| ^~
|
s292607445
|
p04030
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
string s="";
string ans="";
cin>>s;
for(int i=0;i<10;i++){
char temp=s[i];
if(temp=='0')ans.push_back('0');
if(temp=='1')ans.push_back('1');
if(temp=='B'&&!ans.empty())ans.pop_back();
if(temp==null)break;
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:13:14: error: 'null' was not declared in this scope
13 | if(temp==null)break;
| ^~~~
|
s502464194
|
p04030
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
string s="";
string ans="";
cin>>s;
for(int i=0;i<10;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();
if(s[i]==null)break;
}
cout<<ans<<endl;
}
|
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")ans.push_back('0');
a.cc:10:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | if(s[i]=="1")ans.push_back('1');
a.cc:11:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
11 | if(s[i]=="B"&&!ans.empty())ans.pop_back();
a.cc:12:14: error: 'null' was not declared in this scope
12 | if(s[i]==null)break;
| ^~~~
|
s163215743
|
p04030
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
string s="";
string ans="";
cin>>s;
for(int i=0;i<10;i++){
if(s[i]=="0")ans.append("0");
if(s[i]=="1")ans.append("1");
if(s[i]=="B"&&!ans.empty())ans.pop_back();
if(s[i]==eof)break;
}
cout<<ans<<endl;
}
|
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")ans.append("0");
a.cc:10:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | if(s[i]=="1")ans.append("1");
a.cc:11:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
11 | if(s[i]=="B"&&!ans.empty())ans.pop_back();
a.cc:12:14: error: 'eof' was not declared in this scope; did you mean 'feof'?
12 | if(s[i]==eof)break;
| ^~~
| feof
|
s532314402
|
p04030
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
string s="";
string ans="";
cin>>s;
for(int i=0;i<10;i++){
if(s[i]=='0')ans.append('0');
if(s[i]=='1')ans.append('1');
if(s[i]=='B'&&!ans.empty())ans.pop_back();
if(s[i]==eof)break;
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:9:28: error: no matching function for call to 'std::__cxx11::basic_string<char>::append(char)'
9 | if(s[i]=='0')ans.append('0');
| ~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1480:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' (near match)
1480 | append(const _CharT* __s)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1480:7: note: conversion of argument 1 would be ill-formed:
a.cc:9:29: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
9 | if(s[i]=='0')ans.append('0');
| ^~~
| |
| char
/usr/include/c++/14/bits/basic_string.h:1529:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(_InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1529 | append(_InputIterator __first, _InputIterator __last)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1529:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1541:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1541 | append(const _Tp& __svt)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1541:9: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/14/bits/move.h:37,
from /usr/include/c++/14/bits/exception_ptr.h:41,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::__cxx11::basic_string<char>&]':
/usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = char; _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
149 | using _If_sv = enable_if_t<
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1541:9: required by substitution of 'template<class _Tp> std::__cxx11::basic_string<char>::_If_sv<_Tp, std::__cxx11::basic_string<char>&> std::__cxx11::basic_string<char>::append(const _Tp&) [with _Tp = char]'
1541 | append(const _Tp& __svt)
| ^~~~~~
a.cc:9:28: required from here
9 | if(s[i]=='0')ans.append('0');
| ~~~~~~~~~~^~~~~
/usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, std::__cxx11::basic_string<char>&>'
2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type;
| ^~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1557:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _Tp&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1557 | append(const _Tp& __svt, size_type __pos, size_type __n = npos)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1557:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1435:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1435 | append(const basic_string& __str)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1435:34: note: no known conversion for argument 1 from 'char' to 'const std::__cxx11::basic_string<char>&'
1435 | append(const basic_string& __str)
| ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1453:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1453 | append(const basic_string& __str, size_type __pos, size_type __n = npos)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1453:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1466:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1466 | append(const _CharT* __s, size_type __n)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1466:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1498:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1498 | append(size_type __n, _CharT __c)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1498:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1509:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1509 | append(initializer_list<_CharT> __l)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1509:39: note: no known conversion for argument 1 from 'char' to 'std::initializer_list<char>'
1509 | append(initializer_list<_CharT> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:10:28: error: no matching function for call to 'std::__cxx11::basic_string<char>::append(char)'
10 | if(s[i]=='1')ans.append('1');
| ~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1480:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' (near match)
1480 | append(const _CharT* __s)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1480:7: note: conversion of argument 1 would be ill-formed:
a.cc:10:29: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
10 | if(s[i]=='1')ans.append('1');
| ^~~
| |
| char
/usr/include/c++/14/bits/basic_string.h:1529:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(_InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1529 | append(_InputIterator __first, _InputIterator __last)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1529:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1541:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1541 | append(const _Tp& __svt)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1541:9: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/basic_string.h:1557:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _Tp&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1557 | append(const _Tp& __svt, size_type __pos, size_type __n = npos)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1557:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_st
|
s055736257
|
p04030
|
C++
|
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
using namespace std;
typedef long long int lli;
int main(){
string s;
cin>>s;
int l=(int)S.length();
string T;
rep(i,l){
int pat==(int)T.length();
if(S[i]=='0')T.push_back('0');
if(S[i]=='1')T.push_back('1');
if(S[i]=='B'&&pat!=0)T.pop_back();
}
int k=(int)T.length();
rep(i,k)cout<<T[i];
}
|
a.cc: In function 'int main()':
a.cc:17:20: error: 'S' was not declared in this scope
17 | int l=(int)S.length();
| ^
a.cc:20:24: error: expected initializer before '==' token
20 | int pat==(int)T.length();
| ^~
a.cc:23:31: error: 'pat' was not declared in this scope
23 | if(S[i]=='B'&&pat!=0)T.pop_back();
| ^~~
|
s912612615
|
p04030
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
string command="";
string ans="";
cin>>command;
for(int i=0;i<command.size();i++){
if(command.substr(i,1)=="0")ans.append('0');
if(command.substr(i,1)=="1")ans.append('1');
if(command.substr(i,1)=="B" && !ans.empty())ans.pop_back();
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:9:43: error: no matching function for call to 'std::__cxx11::basic_string<char>::append(char)'
9 | if(command.substr(i,1)=="0")ans.append('0');
| ~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1480:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' (near match)
1480 | append(const _CharT* __s)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1480:7: note: conversion of argument 1 would be ill-formed:
a.cc:9:44: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
9 | if(command.substr(i,1)=="0")ans.append('0');
| ^~~
| |
| char
/usr/include/c++/14/bits/basic_string.h:1529:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(_InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1529 | append(_InputIterator __first, _InputIterator __last)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1529:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1541:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1541 | append(const _Tp& __svt)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1541:9: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/14/bits/move.h:37,
from /usr/include/c++/14/bits/exception_ptr.h:41,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::__cxx11::basic_string<char>&]':
/usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = char; _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
149 | using _If_sv = enable_if_t<
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1541:9: required by substitution of 'template<class _Tp> std::__cxx11::basic_string<char>::_If_sv<_Tp, std::__cxx11::basic_string<char>&> std::__cxx11::basic_string<char>::append(const _Tp&) [with _Tp = char]'
1541 | append(const _Tp& __svt)
| ^~~~~~
a.cc:9:43: required from here
9 | if(command.substr(i,1)=="0")ans.append('0');
| ~~~~~~~~~~^~~~~
/usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, std::__cxx11::basic_string<char>&>'
2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type;
| ^~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1557:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _Tp&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1557 | append(const _Tp& __svt, size_type __pos, size_type __n = npos)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1557:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1435:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1435 | append(const basic_string& __str)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1435:34: note: no known conversion for argument 1 from 'char' to 'const std::__cxx11::basic_string<char>&'
1435 | append(const basic_string& __str)
| ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1453:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1453 | append(const basic_string& __str, size_type __pos, size_type __n = npos)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1453:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1466:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1466 | append(const _CharT* __s, size_type __n)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1466:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1498:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1498 | append(size_type __n, _CharT __c)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1498:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1509:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1509 | append(initializer_list<_CharT> __l)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1509:39: note: no known conversion for argument 1 from 'char' to 'std::initializer_list<char>'
1509 | append(initializer_list<_CharT> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:10:43: error: no matching function for call to 'std::__cxx11::basic_string<char>::append(char)'
10 | if(command.substr(i,1)=="1")ans.append('1');
| ~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1480:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' (near match)
1480 | append(const _CharT* __s)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1480:7: note: conversion of argument 1 would be ill-formed:
a.cc:10:44: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
10 | if(command.substr(i,1)=="1")ans.append('1');
| ^~~
| |
| char
/usr/include/c++/14/bits/basic_string.h:1529:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(_InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1529 | append(_InputIterator __first, _InputIterator __last)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1529:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1541:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1541 | append(const _Tp& __svt)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1541:9: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/basic_string.h:1557:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _Tp&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1557 | append(c
|
s211924024
|
p04030
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
string command="";
string ans="";
cin>>command;
for(int i=0;i<command.size();i++){
if(command.substr(i,1)=='0')ans.append('0');
if(command.substr(i,1)=='1')ans.append('0');
if(command.substr(i,1)=='B'&&!ans.empty())ans.pop_back();
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:9:27: error: no match for 'operator==' (operand types are 'std::__cxx11::basic_string<char>' and 'char')
9 | if(command.substr(i,1)=='0')ans.append('0');
| ~~~~~~~~~~~~~~~~~~~^~~~~
| | |
| | char
| std::__cxx11::basic_string<char>
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::fpos<_StateT>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
In file included from /usr/include/c++/14/string:43,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::allocator<_CharT>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::move_iterator<_IteratorL>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::move_iterator<_IteratorL>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::pair<_T1, _T2>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
/usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: mismatched types 'const _CharT*' and 'char'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3819 | operator==(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2558 | operator==(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::tuple<_UTypes ...>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46:
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)'
234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
| ^~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::istreambuf_iter
|
s513005450
|
p04030
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
string command="";
string ans="";
cin>>command;
for(int i=0;i<command.size();i++){
if(command.substr(i,1)=='0')ans.append('0');
if(command.substr(i,1)=='1')ans.append('0');
if(command.substr(i,1)=='B')ans.pop_back();
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:9:27: error: no match for 'operator==' (operand types are 'std::__cxx11::basic_string<char>' and 'char')
9 | if(command.substr(i,1)=='0')ans.append('0');
| ~~~~~~~~~~~~~~~~~~~^~~~~
| | |
| | char
| std::__cxx11::basic_string<char>
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::fpos<_StateT>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
In file included from /usr/include/c++/14/string:43,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::allocator<_CharT>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::move_iterator<_IteratorL>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::move_iterator<_IteratorL>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::pair<_T1, _T2>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
/usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: mismatched types 'const _CharT*' and 'char'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3819 | operator==(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2558 | operator==(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::tuple<_UTypes ...>'
9 | if(command.substr(i,1)=='0')ans.append('0');
| ^~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46:
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)'
234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
| ^~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed:
a.cc:9:29: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::istreambuf_iter
|
s352942037
|
p04030
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
string command="";
string ans="";
int number=0;
cin>>command;
for(int i=0;i<command.size();i++){
if(command[i]=="0")ans.append("0");
if(command[i]=="1")ans.append("1");
if(command[i]=="B")ans.pop_back();
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:10:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | if(command[i]=="0")ans.append("0");
a.cc:11:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
11 | if(command[i]=="1")ans.append("1");
a.cc:12:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
12 | if(command[i]=="B")ans.pop_back();
|
s098346170
|
p04030
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
string command="";
string ans="";
int number=0;
cin>>command;
for(int i=0;i<command.size();i++){
if(command[i].strcomp("0"))ans.append("0");
if(command[i].strcomp("1"))ans.append("1");
if(command[i].strcomp("B"))ans.pop_back();
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:10:19: error: request for member 'strcomp' in 'command.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
10 | if(command[i].strcomp("0"))ans.append("0");
| ^~~~~~~
a.cc:11:19: error: request for member 'strcomp' in 'command.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
11 | if(command[i].strcomp("1"))ans.append("1");
| ^~~~~~~
a.cc:12:19: error: request for member 'strcomp' in 'command.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
12 | if(command[i].strcomp("B"))ans.pop_back();
| ^~~~~~~
|
s799466065
|
p04030
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
string command="";
string ans="";
int number=0;
cin>>command;
for(int i=0;i<command.size();i++)
switch(command[i]){
case("0"):ans.append("0");break;
case("1"):ans.append("1");break;
case("B"):ans.pop_back();
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:11:14: error: conversion from 'const char*' to 'int' in a converted constant expression
11 | case("0"):ans.append("0");break;
| ~^~~~
a.cc:11:14: error: could not convert '("0")' from 'const char [2]' to 'int'
11 | case("0"):ans.append("0");break;
| ~^~~~
| |
| const char [2]
a.cc:12:14: error: conversion from 'const char*' to 'int' in a converted constant expression
12 | case("1"):ans.append("1");break;
| ~^~~~
a.cc:12:14: error: could not convert '("1")' from 'const char [2]' to 'int'
12 | case("1"):ans.append("1");break;
| ~^~~~
| |
| const char [2]
a.cc:13:14: error: conversion from 'const char*' to 'int' in a converted constant expression
13 | case("B"):ans.pop_back();
| ~^~~~
a.cc:13:14: error: could not convert '("B")' from 'const char [2]' to 'int'
13 | case("B"):ans.pop_back();
| ~^~~~
| |
| const char [2]
|
s702069917
|
p04030
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
string command="";
string ans="";
int number=0;
cin>>command;
for(int i=0;i<command.size();i++)
switch(s[i]){
case("0"):ans.append("0");
case("1"):ans.append("1");
case("B"):ans.pop_back();
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:10:12: error: 's' was not declared in this scope
10 | switch(s[i]){
| ^
|
s631896185
|
p04030
|
Java
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
while(str.contains("B")){
int idx = str.indexOf("B");
s = (idx > 0 ? s.substring(0,idx-1) : "") + s.substring(idx+1);
}
System.out.println(s);
}}
|
Main.java:6: error: cannot find symbol
while(str.contains("B")){
^
symbol: variable str
location: class Main
Main.java:7: error: cannot find symbol
int idx = str.indexOf("B");
^
symbol: variable str
location: class Main
2 errors
|
s440913177
|
p04030
|
C++
|
#include <string>
#include<iostream>
#include <algorithm>
#include<sstream>
#include<list>
#include <cstdio>
//#include <stdio.h>
using namespace std;
int main ()
{
string S;
cin>>S;
list<char> ans;
for(int i =0;i<S.size();i++ ){
if(S[i]=='1' or S[i]=='0' ){
ans.push_back(S[i]);
}
else if(S[i]=='B'){
ans.pop_back();
}
}
for(char itr = ans.begin(); itr != ans.end(); ++itr) {
std::cout << *itr;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:33:25: error: cannot convert 'std::__cxx11::list<char>::iterator' to 'char' in initialization
33 | for(char itr = ans.begin(); itr != ans.end(); ++itr) {
| ~~~~~~~~~^~
| |
| std::__cxx11::list<char>::iterator
a.cc:33:33: error: no match for 'operator!=' (operand types are 'char' and 'std::__cxx11::list<char>::iterator')
33 | for(char itr = ans.begin(); itr != ans.end(); ++itr) {
| ~~~ ^~ ~~~~~~~~~
| | |
| char std::__cxx11::list<char>::iterator
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from a.cc:2:
/usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)'
197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed:
a.cc:33:44: note: mismatched types 'const std::fpos<_StateT>' and 'char'
33 | for(char itr = ans.begin(); itr != ans.end(); ++itr) {
| ^
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)'
243 | operator!=(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed:
a.cc:33:44: note: mismatched types 'const std::allocator<_CharT>' and 'char'
33 | for(char itr = ans.begin(); itr != ans.end(); ++itr) {
| ^
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
455 | operator!=(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed:
a.cc:33:44: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'char'
33 | for(char itr = ans.begin(); itr != ans.end(); ++itr) {
| ^
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
500 | operator!=(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed:
a.cc:33:44: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'char'
33 | for(char itr = ans.begin(); itr != ans.end(); ++itr) {
| ^
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1686 | operator!=(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed:
a.cc:33:44: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'char'
33 | for(char itr = ans.begin(); itr != ans.end(); ++itr) {
| ^
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1753 | operator!=(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed:
a.cc:33:44: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'char'
33 | for(char itr = ans.begin(); itr != ans.end(); ++itr) {
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed:
a.cc:33:44: note: mismatched types 'const std::pair<_T1, _T2>' and 'char'
33 | for(char itr = ans.begin(); itr != ans.end(); ++itr) {
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
651 | operator!=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed:
a.cc:33:44: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char'
33 | for(char itr = ans.begin(); itr != ans.end(); ++itr) {
| ^
/usr/include/c++/14/string_view:658:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
658 | operator!=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed:
a.cc:33:44: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char'
33 | for(char itr = ans.begin(); itr != ans.end(); ++itr) {
| ^
/usr/include/c++/14/string_view:666:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed:
a.cc:33:44: note: 'std::_List_iterator<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
33 | for(char itr = ans.begin(); itr != ans.end(); ++itr) {
| ^
/usr/include/c++/14/bits/basic_string.h:3833:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3833:5: note: template argument deduction/substitution failed:
a.cc:33:44: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char'
33 | for(char itr = ans.begin(); itr != ans.end(); ++itr) {
| ^
/usr/include/c++/14/bits/basic_string.h:3847:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3847 | operator!=(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3847:5: note: template argument deduction/substitution failed:
a.cc:33:44: note: mismatched types 'const _CharT*' and 'char'
33 | for(char itr = ans.begin(); itr != ans.end(); ++itr) {
| ^
/usr/include/c++/14/bits/basic_string.h:3860:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3860 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3860:5: note: template argument deduction/substitution failed:
a.cc:33:44: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char'
33 | for(char itr = ans.begin(); itr != ans.end(); ++itr) {
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2613 | operator!=(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed:
a.cc:33:44: note: mismatched types 'const std::tuple<_UTypes ...>' and 'char'
33 | for(char itr = ans.begin(); itr != ans.end(); ++itr) {
| ^
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:3:
/usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator!=(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)'
242 | operator!=(const istreambuf_iterator<_CharT, _Traits>& __a,
|
s594566265
|
p04030
|
C++
|
#include <iostream>
using namespace std;
int main(){
string S, A;
for(int i=0; i<10; i++){
char x;
cin >> x;
if(x=='0'){
A += "0";
} else if(x=='1'){
A += "1";
} else if(x=='B'){
if(A.size()>0){
A.size()--;
}
}
}
cout << A << endl;
}
|
a.cc: In function 'int main()':
a.cc:15:39: error: lvalue required as decrement operand
15 | A.size()--;
| ~~~~~~^~
|
s441781090
|
p04030
|
C++
|
#include <iostream>
using namespace std;
int main(){
string S, A;
for(int i=0; i<10; i++){
char x;
cin >> x;
if(x=='0'){
A += "0";
} else if(x=='1'){
A += "1";
} else if(x=='B'){
A -= ""
}
}
cout << A << endl;
}
|
a.cc: In function 'int main()':
a.cc:14:27: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'const char [1]')
14 | A -= ""
| ~~^~~~~
|
s361282681
|
p04030
|
C++
|
#include <iostream>
using namespace std;
int main(){
string S, A;
for(int i=0; i<10; i++){
char x;
cin >> x;
if(x=='0'){
A += "0";
} else if(x=='1'){
A += "1";
} else if(x=='B'){
*(A.end()-1) = '';
}
}
cout << A << endl;
}
|
a.cc:14:40: error: empty character constant
14 | *(A.end()-1) = '';
| ^~
|
s156267098
|
p04030
|
C++
|
#include <iostream>
using namespace std;
int main(){
string S, A;
for(int i=0; i<10; i++){
char x;
cin >> x;
if(x=='0'){
A += "0";
} else if(x=='1'){
A += "1";
} else if(x=='B'){
*A.end() = '';
}
}
cout << A << endl;
}
|
a.cc:14:36: error: empty character constant
14 | *A.end() = '';
| ^~
|
s049113808
|
p04030
|
C++
|
#include <iostream>
using namespace std;
int main(){
string S, A;
for(int i=0; i<10; i++){
char x;
cin >> x;
if(x=='0'){
A += "0";
} else if(x=='1'){
A += "1";
} else if(x=='B'){
*A.end() = "";
}
}
cout << A << endl;
}
|
a.cc: In function 'int main()':
a.cc:14:36: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
14 | *A.end() = "";
| ^~
| |
| const char*
|
s651252911
|
p04030
|
C++
|
#include <iostream>
using namespace std;
int main(){
string S, A;
for(int i=0; i<10; i++){
char x;
cin >> x;
if(x=='0'){
A += "0";
} else if(x=='1'){
a += "1";
} else if(x=='B'){
if(A.size()!=0){
A -= *A.end();
}
}
}
cout << A << endl;
}
|
a.cc: In function 'int main()':
a.cc:12:25: error: 'a' was not declared in this scope
12 | a += "1";
| ^
a.cc:15:35: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
15 | A -= *A.end();
| ~~^~~~~~~~~~~
|
s510082601
|
p04030
|
C++
|
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<string>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
#include<assert.h>
//#include<chrono>
//#include<time.h>
//#include<windows.h>
using namespace std;
//#define int ll
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
//static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
#define ALL(x) (x).begin(),(x).end()
struct edge {int /*from,*/to,cost;};
main(){
string s;
cin >> s;
string ans;
REP(i,LEN(s)){
if(!isdigit(s[i])) ans.erase(LEN(ans)-1,1);
else ans += s[i];
}
cin >> ans << endl;
return 0;
}
|
a.cc:63:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
63 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:72:16: error: no match for 'operator<<' (operand types are 'std::basic_istream<char>' and '<unresolved overloaded function type>')
72 | cin >> ans << endl;
| ~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_ostream<_CharT, _Traits>'
72 | cin >> ans << endl;
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_ostream<_CharT, _Traits>'
72 | cin >> ans << endl;
| ^~~~
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: couldn't deduce template parameter '_IntegerType'
72 | cin >> ans << endl;
| ^~~~
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_ostream<_CharT, _Traits>'
72 | cin >> ans << endl;
| ^~~~
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_ostream<_CharT, _Traits>'
72 | cin >> ans << endl;
| ^~~~
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_ostream<_CharT, _Traits>'
72 | cin >> ans << endl;
| ^~~~
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_ostream<char, _Traits>'
72 | cin >> ans << endl;
| ^~~~
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_ostream<char, _Traits>'
72 | cin >> ans << endl;
| ^~~~
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_ostream<char, _Traits>'
72 | cin >> ans << endl;
| ^~~~
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_ostream<_CharT, _Traits>'
72 | cin >> ans << endl;
| ^~~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_ostream<_CharT, _Traits>'
72 | cin >> ans << endl;
| ^~~~
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_ostream<char, _Traits>'
72 | cin >> ans << endl;
| ^~~~
/usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)'
684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_ostream<char, _Traits>'
72 | cin >> ans << endl;
| ^~~~
/usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)'
689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_ostream<char, _Traits>'
72 | cin >> ans << endl;
| ^~~~
/usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
/usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: couldn't deduce template parameter '_Tp'
72 | cin >> ans << endl;
| ^~~~
In file included from a.cc:8:
/usr/include/c++/14/iomanip:84:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _Resetiosflags)'
84 | operator<<(basic_ostream<_CharT, _Traits>& __os, _Resetiosflags __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:84:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_ostream<_CharT, _Traits>'
72 | cin >> ans << endl;
| ^~~~
/usr/include/c++/14/iomanip:114:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _Setiosflags)'
114 | operator<<(basic_ostream<_CharT, _Traits>& __os, _Setiosflags __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:114:5: note: template argument deduction/substitution failed:
a.cc:72:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_ostream<_CharT, _Traits>'
72 | cin >> ans << endl;
| ^~~~
/usr/include/c++/14/iom
|
s917415035
|
p04030
|
C++
|
#include<iostream>
using namespace std;
int main(){
char s[] ;
cin >> s ;
int i = 0;
char out[sizeof(s)];
int j = 0;
for (i = 0; i <= sizeof(s); i++){
if (s[i] == '0') {
out[j] += '0';
j++;
}
else if (s[i] == '1'){
out[j] += '1';
j++;
}
if (s[i]== 'B') {
if (j > 0){
out[j-1] = '\0';
j--;
}
}
}
cout << out << endl;
}
|
a.cc: In function 'int main()':
a.cc:7:11: error: storage size of 's' isn't known
7 | char s[] ;
| ^
a.cc:16:13: error: 'out' was not declared in this scope
16 | out[j] += '0';
| ^~~
a.cc:20:13: error: 'out' was not declared in this scope
20 | out[j] += '1';
| ^~~
a.cc:27:17: error: 'out' was not declared in this scope
27 | out[j-1] = '\0';
| ^~~
a.cc:35:13: error: 'out' was not declared in this scope
35 | cout << out << endl;
| ^~~
|
s306850990
|
p04030
|
C++
|
s = input()
ans = []
for ch in s:
if ch == '0':
ans.append('0')
elif ch == '1':
ans.append('1')
else:
if len(ans) != 0:
ans.pop()
print("".join(ans))
|
a.cc:1:1: error: 's' does not name a type
1 | s = input()
| ^
|
s495103074
|
p04030
|
C++
|
// inputに入力データ全体が入る
function Main(input) {
ans = [];
for(let i=0;i<input.length;i++){
if(input[i] == 'B') ans.pop();
else ans.push(input[i]);
}
console.log(ans.join(''));
}
//*この行以降は編集しないでください(標準入出力から一度に読み込み、Mainを呼び出します)
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
|
a.cc:8:30: error: empty character constant
8 | console.log(ans.join(''));
| ^~
a.cc:2:1: error: 'function' does not name a type; did you mean 'union'?
2 | function Main(input) {
| ^~~~~~~~
| union
a.cc:11:5: error: expected constructor, destructor, or type conversion before '(' token
11 | Main(require("fs").readFileSync("/dev/stdin", "utf8"));
| ^
|
s443341146
|
p04030
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
int main() {
std::string s, ans;
std::cin >> s;
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');
}
else{
if(!ans.empty)
ans.pop_back();
}
}
std::cout << ans << std::endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:20:33: error: cannot convert 'std::__cxx11::basic_string<char>::empty' from type 'bool (std::__cxx11::basic_string<char>::)() const noexcept' to type 'bool'
20 | if(!ans.empty)
| ^~~~~
a.cc:20:33: error: in argument to unary !
20 | if(!ans.empty)
| ~~~~^~~~~
|
s647936133
|
p04030
|
C++
|
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>
#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
using namespace std;
typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;
char mp[100];
int main()
{
string str;cin >> str;
int now = 0;
REP(i,str.size())
{
if(sre[i] == 'B' && now > 0)now--;
else
{
[now] = str[i];
now++;
}
}
REP(i,now)
{
cout << mp[i];
}cout << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:49:20: error: 'sre' was not declared in this scope
49 | if(sre[i] == 'B' && now > 0)now--;
| ^~~
a.cc: In lambda function:
a.cc:52:31: error: expected '{' before '=' token
52 | [now] = str[i];
| ^
a.cc: In function 'int main()':
a.cc:52:38: error: no match for 'operator=' (operand types are 'main()::<lambda()>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'})
52 | [now] = str[i];
| ^
a.cc:52:29: note: candidate: 'main()::<lambda()>& main()::<lambda()>::operator=(const main()::<lambda()>&)' (deleted)
52 | [now] = str[i];
| ^
a.cc:52:29: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const main()::<lambda()>&'
|
s344784353
|
p04030
|
C++
|
0BB1
|
a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 0BB1
| ^~~~
|
s894627249
|
p04030
|
C++
|
abc
|
a.cc:1:1: error: 'abc' does not name a type
1 | abc
| ^~~
|
s031977221
|
p04030
|
C++
|
// glory be to the sky
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
string input;
vector<char> output;
cin >> input;
for (int i = 0; i < input.length(); i++) {
if (input[i] == '0') output.pb('0');
else if (input[i] == '1') output.pb('1');
else if (output.size()) output.pop_back();
}
for (int i = 0; i < output.size(); i++) cout << output[i];
return 0;
}
|
a.cc: In function 'int main()':
a.cc:16:45: error: 'class std::vector<char>' has no member named 'pb'
16 | if (input[i] == '0') output.pb('0');
| ^~
a.cc:17:50: error: 'class std::vector<char>' has no member named 'pb'
17 | else if (input[i] == '1') output.pb('1');
| ^~
|
s123381974
|
p04030
|
C
|
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<cmath>
#include<cctype>
#include<ctime>
#define pi acos(-1.0)
using namespace std;
int main()
{
string a;
cin>>a;
int len=a.length();
stack <char> q ;
for(int i=0;i<len;i++){
if(a[i]=='1'){
q.push('1');
}
else if(a[i]=='0'){
q.push('0');
}
else if(a[i]=='B'){
if(q.size()>0)
q.pop();
}
}
while(q.size()>0){
cout<<q.top();
q.pop();
}
cout<<endl;
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s725101342
|
p04030
|
C++
|
#include<iostream>
#include<cstring>
#include<vector>
#include<stack>
#include<cstdio>
using namespace std;
char a[50],b[50];
int main()
{
vector<char>q;
while(cin>>a)
{
int len=a.size();
for(int i=0;i<len;i++)
{
if(a[i]=='0')
q.push_back('0');
else if(a[i]=='1')
q.push_back('1');
else if(!q.empty())
q.pop_back();
}
int j=q.size();
for(int i=0;i<j;i++)
{
cout<<b[i];
}
cout<<endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:13:27: error: request for member 'size' in 'a', which is of non-class type 'char [50]'
13 | int len=a.size();
| ^~~~
|
s691428751
|
p04030
|
C++
|
#include<iostream>
#include<cstring>
#include<vextor>
#include<stack>
#include<cstdio>
using namespace std;
char a[50],b[50];
int main()
{
vector<char>q;
while(cin>>a)
{
int len=a.size();
for(int i=0;i<len;i++)
{
if(a[i]=='0')
q.push_back('0');
else if(a[i]=='1')
q.push_back('1');
else if(!q.empty())
q.pop_back();
}
int j=q.size();
for(int i=0;i<j;i++)
{
cout<<b[i];
}
cout<<endl;
}
return 0;
}
|
a.cc:3:9: fatal error: vextor: No such file or directory
3 | #include<vextor>
| ^~~~~~~~
compilation terminated.
|
s293268682
|
p04030
|
C++
|
#include<iostream>
using namespace std;
#include<cstring>
#include<cstdio>
int a[20];
char s[20];
int main()
{
gets(s);
// puts(s);
int k=-1;
for(int i=0;i<strlen(s);i++)
{
if(s[i]=='0')
{
k++;
a[k]=0;
}
if(s[i]=='1')
{
k++;
a[k]=1;
}
if(s[i]=='B')
if(k>=0)
k--;
}
for(int i=0;i<=k;i++)
{
cout<<a[i];
}
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(s);
| ^~~~
| getw
|
s294731088
|
p04030
|
C++
|
#include<iostream>
using namespace std;
#include<cstring>
#include<cstdio>
int a[20];
char s[20];
int main()
{
gets(s);
// puts(s);
int k=-1;
for(int i=0;i<strlen(s);i++)
{
if(s[i]=='0')
{
k++;
a[k]=0;
}
if(s[i]=='1')
{
k++;
a[k]=1;
}
if(s[i]=='B')
if(k>=0)
k--;
}
for(int i=0;i<=k;i++)
{
cout<<a[i];
}
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(s);
| ^~~~
| getw
|
s530355552
|
p04030
|
C++
|
#include<iostream>
using namespace std;
#include<cstring>
int a[20];
char s[20];
int main()
{
gets(s);
// puts(s);
int k=-1;
for(int i=0;i<strlen(s);i++)
{
if(s[i]=='0')
{
k++;
a[k]=0;
}
if(s[i]=='1')
{
k++;
a[k]=1;
}
if(s[i]=='B')
if(k>=0)
k--;
}
for(int i=0;i<=k;i++)
{
cout<<a[i];
}
return 0;
}
|
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
|
s523172557
|
p04030
|
C++
|
#include"stdio.h"
#include"cstdio"
#include"algorithm"
#include"string.h"
using namespace std;
const int max_n=1e4+10;
char A[max_n];
char S[50];
int main()
{
while(gets(A)!=NULL)
{
int i,k=-1,n=strlen(A);
memset(S,0,sizeof(S));
for(i=0;i<n;i++)
{
if(A[i]=='0')
{
S[++k]='0';
}
if(A[i]=='1')
{
S[++k]='1';
}
if(A[i]=='B')
{
if(strlen(S))
S[k--]=0;
}
}
printf("%s\n",S);
}
}
|
a.cc: In function 'int main()':
a.cc:11:15: error: 'gets' was not declared in this scope; did you mean 'getw'?
11 | while(gets(A)!=NULL)
| ^~~~
| getw
|
s135215630
|
p04030
|
C++
|
#include<cstring>
#include<cstdio>
using namespace std;
int main()
{
char s[15],a[15];
gets(s);
int len =strlen(s);
int l=0;
for(int i=0;i<len ;i++)
{
if(s[i]=='0'||s[i]=='1')
a[l++]=s[i];
if(s[i]=='B'&&l>=1)
l--;
}
for(int i=0;i<l;i++)
printf("%c",a[i]);
printf("\n");
return 0;
}
|
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
|
s483705889
|
p04030
|
C++
|
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
using namespace std;
int main()
{
string s;
while(cin>>s)
{
for(int i=0;i<s.size();i++)
{
if(s[i]=='0')
{
ch.push_back('0');
}
else if(s[i]=='1')
{
ch.push_back('1');
}
else if(!ch.empty())
{
ch.pop_back();
}
}
for(int i=0;i<ch.size();i++)
{
cout<<ch[i];
}
cout<<endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:17:17: error: 'ch' was not declared in this scope
17 | ch.push_back('0');
| ^~
a.cc:21:17: error: 'ch' was not declared in this scope
21 | ch.push_back('1');
| ^~
a.cc:23:22: error: 'ch' was not declared in this scope
23 | else if(!ch.empty())
| ^~
a.cc:28:23: error: 'ch' was not declared in this scope
28 | for(int i=0;i<ch.size();i++)
| ^~
|
s775635445
|
p04030
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main() {
string s, str="";
cin >> s;
for (int i = 0;i < s.size();i++) {
if ((s[i]=='0'||s[i]=='1') {
str += s[i];
}
else {
str = str.substr(0, str.size() - 1);
}
}
cout << str << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:8:43: error: expected ')' before '{' token
8 | if ((s[i]=='0'||s[i]=='1') {
| ~ ^~
| )
a.cc:14:9: error: expected primary-expression before '}' token
14 | }
| ^
|
s471205307
|
p04030
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main() {
string s, str;
cin >> s;
for (int i = 0;i < s.size();i++) {
if ((s[i] == 0) || (s[i] == 1)) {
str += s[i];
}
else
str = str.substr(0, str.size()-1);
cout << str << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:15:2: error: expected '}' at end of input
15 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s164974708
|
p04030
|
C++
|
#include <stdio.h>
#include <conio.h>
int main(){
char S[11];
char A[11]={};
int x=0;
scanf("%s",&S);
for(int i=0;i<11;i++){
if(S[i]=='0'){
A[x]='0';
x++;
}
else if(S[i]=='1'){
A[x]='1';
x++;
}
else if(S[i]=='B'){
if(x!=0)
x--;
}
}
for(int i=0;i<x;i++){
printf("%c",A[i]);
}
printf("\n");
getch();
}
|
a.cc:2:10: fatal error: conio.h: No such file or directory
2 | #include <conio.h>
| ^~~~~~~~~
compilation terminated.
|
s514197301
|
p04030
|
C++
|
#include <cstdio>
#ifdef _MSC_VER
#include <conio.h>
#else
#define getch()
#endif
#include <string>
#include <queue>
using std::string;
using std::queue;
int main(){
queue<char> Input;
string Str="";
char Buf[11]="";
scanf("%s",Buf);
for(int i=0;i<strlen(Buf);i++){
Input.push(Buf[i]);
}
while(Input.empty()!=true){
char Top=Input.front();
Input.pop();
switch(Top){
case '0':
//printf("Pushed 0\n");
Str.push_back('0');
break;
case '1':
//printf("Pushed 1\n");
Str.push_back('1');
break;
case 'B':
if(Str.empty()!=true){
//printf("Erased\n");
Str.erase(Str.size()-1);
}
break;
}
}
printf("%s\n",Str.c_str());
getch();
return 0;
}
|
a.cc: In function 'int main()':
a.cc:18:23: error: 'strlen' was not declared in this scope
18 | for(int i=0;i<strlen(Buf);i++){
| ^~~~~~
a.cc:9:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
8 | #include <queue>
+++ |+#include <cstring>
9 |
|
s258594238
|
p04030
|
C++
|
//ABC043B
#include <iostream>
#include <string>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;
int main(){
string s;
list<char> st;
cin>>s;
for(int i=0;i<s.size();i++){
if(s[i]=='0'||s[i]=='1'){
st.push_back(s[i]);
}else if(s[i]=='B'){
if(!st.empty()){
st.pop_back();
}
}
}
for(int i=0;i<st.size();i++){
cout<<st.front();
st.pop.front();
}
cout<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:27:16: error: 'class std::__cxx11::list<char>' has no member named 'pop'
27 | st.pop.front();
| ^~~
|
s076847151
|
p04030
|
C++
|
package main
import (
"fmt"
)
func main(){
var b string
fmt.Scan(&b)
var out []rune
for _,v := range b {
switch v {
case 'B':
if len(out) > 0 {
out = out[:len(out) - 1]
}
default:
out = append(out, v)
}
}
fmt.Println(string(out))
}
|
a.cc:1:1: error: 'package' does not name a type
1 | package main
| ^~~~~~~
|
s829347480
|
p04030
|
Java
|
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s=new Scanner(System.in);
String S=s.next();
boolean f[]=new boolean[S.length()];
int i=0;
for(i=0;i<S.length();i++){
f[i]=true;
if(S.charAt(i)=='B'){
f[i-1]=false;
f[i]=false;
}
}
for(i=0;i<S.length();i++){
if(f[i]==true)System.out.print(S.charAt(i));
}
}
}
|
Main.java:5: error: cannot find symbol
Scanner s=new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:5: error: cannot find symbol
Scanner s=new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s660656525
|
p04030
|
C++
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String s=sc.next();
String m="";
String taihi="";
for(int i=0;i<s.length();i++){
if(s.charAt(i)=='B'){
for(int j=0;j<m.length()-1;j++){
taihi+=m.charAt(j);
}
m=taihi;
taihi="";
}else{
m+=s.charAt(i);
}
}
System.out.println(m);
}
}
|
a.cc:1:3: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:3: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:3: error: expected unqualified-id before 'public'
2 | public class Main {
| ^~~~~~
|
s316262106
|
p04030
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
string s; cin >> s;
string str;
for (int i = 0; i < s.size(); i++){
if (s[i] == '0')str += '0';
else if (s[i] == '1')str += '1';
else if (s[i] == 'B'&&s.size != 0)s.pop_back();
}
cout << str << endl;
}
|
a.cc: In function 'int main()':
a.cc:10:41: 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 unsigned int]' (did you forget the '()' ?)
10 | else if (s[i] == 'B'&&s.size != 0)s.pop_back();
| ~~^~~~
| ()
|
s418784787
|
p04030
|
C++
|
ra
|
a.cc:1:1: error: 'ra' does not name a type
1 | ra
| ^~
|
s988831128
|
p04030
|
C++
|
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>
//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else
//#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define VV(T) vector<vector< T > >
template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
v.assign(a, vector<T>(b, t));
}
template <class F, class T>
void convert(const F &f, T &t){
stringstream ss;
ss << f;
ss >> t;
}
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x) cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x)
#define debug(x)
#endif
#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
void mainmain(){
string s;
cin>>s;
stirng ans = "";
rep(i,s.size()){
if(s[i]=='B'){
if(ans.size()==0){
continue;
}
else{
ans = ans.substr(0,ans.size()-1);
}
}
else{
ans += s[i];
}
}
cout<<ans<<endl;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout<<fixed<<setprecision(20);
mainmain();
}
|
a.cc: In function 'void mainmain()':
a.cc:100:9: error: 'stirng' was not declared in this scope
100 | stirng ans = "";
| ^~~~~~
a.cc:103:28: error: 'ans' was not declared in this scope; did you mean 'abs'?
103 | if(ans.size()==0){
| ^~~
| abs
a.cc:111:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
111 | ans += s[i];
| ^~~
| abs
a.cc:114:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
114 | cout<<ans<<endl;
| ^~~
| abs
|
s566488672
|
p04030
|
Java
|
public class Main {
public static void main(String Args[]){
Scanner sc=new Scanner(System.in);
String str = sc.next();
StringBuffer sb1 = new StringBuffer();
char []hoge = str.toCharArray();
for(char ch:hoge){
if(ch == '0'){
sb1.append(0);
}
if(ch == '1'){
sb1.append(1);
}
if(ch == 'B'){
if(sb1.length() > 0){
sb1.delete(sb1.length()-1,sb1.length());
}
}
}
System.out.println(sb1);
}
}
|
Main.java:5: error: cannot find symbol
Scanner sc=new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:5: error: cannot find symbol
Scanner sc=new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s901060321
|
p04030
|
C++
|
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
const long long INF = LLONG_MAX / 2;
#define FOR(i, r, n) for(int i=(r); i<(n); i++)
#define REP(i, n) FOR(i, (0), n)
#define ll long long int
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
vector.erase(vector.begin() + index);
}
using namespace std;
ll ans = 0, sum = 0, n, k, t;
string s;
vector<ll> v;
int main() {
cin >> s;
REP(i, s.size()) {
if (s[i] == '0') {
v.push_back(0);
}
else if (s[i] == '1') {
v.push_back(1);
}
else if (s[i] == 'B') {
if (v.size()) {
v.pop_back();
}
}
}
REP(i, v.size()) {
cout << v[i];
}
cout << endl;
}
|
a.cc:7:23: error: 'LLONG_MAX' was not declared in this scope
7 | const long long INF = LLONG_MAX / 2;
| ^~~~~~~~~
a.cc:7:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
6 | #include <vector>
+++ |+#include <climits>
7 | const long long INF = LLONG_MAX / 2;
|
s578192240
|
p04030
|
Java
|
import java.util.Scanner;
public class Hacking {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String str = scanner.nextLine();
String str2 = "";
for(char c : str.toCharArray()){
if(c == 'b'){
if(!str2.equals("")){
str2 = str2.substring(0,str2.length()-1);
}
}
else{
str2 += c;
}
}
System.out.println(str2);
}
}
|
Main.java:3: error: class Hacking is public, should be declared in a file named Hacking.java
public class Hacking {
^
1 error
|
s765007959
|
p04030
|
C++
|
#include <iostream>
#include <stack>
using namespace std;
int main() {
string s;
string st;
cin >> s;
for (auto i = s.begin(); i != s.end(); i++) {
if (*i=='B') st.pop_back();
else st.push_back(*i)
}
cout << st << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:22: error: expected ';' before '}' token
12 | else st.push_back(*i)
| ^
| ;
13 | }
| ~
|
s434842763
|
p04030
|
C++
|
#include <iostream>
#include <stack>
using namespace std;
int main() {
string s;
string st
cin >> s;
for (auto i = s.begin(); i != s.end(); i++) {
if (*i=='B') st.pop_back();
else st.push_back(*i)
}
cout << st << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:9:1: error: expected initializer before 'cin'
9 | cin >> s;
| ^~~
a.cc:11:14: error: 'st' was not declared in this scope; did you mean 's'?
11 | if (*i=='B') st.pop_back();
| ^~
| s
a.cc:12:6: error: 'st' was not declared in this scope; did you mean 's'?
12 | else st.push_back(*i)
| ^~
| s
a.cc:14:9: error: 'st' was not declared in this scope; did you mean 's'?
14 | cout << st << endl;
| ^~
| s
|
s001452841
|
p04030
|
C
|
include<stdio.h>
int main(void)
{
char S[500];
scanf("%S",S);
printf("%S",S);
rewind(stdin);
getchar();
return 0;
}
|
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include<stdio.h>
| ^
|
s188471453
|
p04030
|
C
|
include<stdio.h>
int main(void)
{
char S[500];
scanf("%S",S);
printf("%S",S);
rewind(stdin);
getchar();
return 0;
}
|
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include<stdio.h>
| ^
|
s000934676
|
p04030
|
C++
|
#include<iostream>
#include<string>
using std::cin;
using std::cout;
using std::endl;
using std::string;
string s, result;
int main() {
cin >> s;
for(auto c : s) {
if(c == 'B') {
if(!result.empty()) result.erase(result.size()-1);
continue;
}
result.append(c);
}
cout << result << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:17:30: error: no matching function for call to 'std::__cxx11::basic_string<char>::append(char&)'
17 | result.append(c);
| ~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1480:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' (near match)
1480 | append(const _CharT* __s)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1480:7: note: conversion of argument 1 would be ill-formed:
a.cc:17:31: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
17 | result.append(c);
| ^
| |
| char
/usr/include/c++/14/bits/basic_string.h:1529:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(_InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1529 | append(_InputIterator __first, _InputIterator __last)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1529:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1541:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1541 | append(const _Tp& __svt)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1541:9: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/14/bits/move.h:37,
from /usr/include/c++/14/bits/exception_ptr.h:41,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::__cxx11::basic_string<char>&]':
/usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = char; _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
149 | using _If_sv = enable_if_t<
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1541:9: required by substitution of 'template<class _Tp> std::__cxx11::basic_string<char>::_If_sv<_Tp, std::__cxx11::basic_string<char>&> std::__cxx11::basic_string<char>::append(const _Tp&) [with _Tp = char]'
1541 | append(const _Tp& __svt)
| ^~~~~~
a.cc:17:16: required from here
17 | result.append(c);
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, std::__cxx11::basic_string<char>&>'
2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type;
| ^~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1557:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _Tp&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1557 | append(const _Tp& __svt, size_type __pos, size_type __n = npos)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1557:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1435:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1435 | append(const basic_string& __str)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1435:34: note: no known conversion for argument 1 from 'char' to 'const std::__cxx11::basic_string<char>&'
1435 | append(const basic_string& __str)
| ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1453:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1453 | append(const basic_string& __str, size_type __pos, size_type __n = npos)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1453:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1466:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1466 | append(const _CharT* __s, size_type __n)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1466:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1498:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1498 | append(size_type __n, _CharT __c)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1498:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1509:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1509 | append(initializer_list<_CharT> __l)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1509:39: note: no known conversion for argument 1 from 'char' to 'std::initializer_list<char>'
1509 | append(initializer_list<_CharT> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
|
s390790623
|
p04030
|
C++
|
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define sz 12
char s[sz + 2];
int main(){
int i, j, len;
int p = 0;
scanf("%s", s)
len = strlen(s);
if(len == 1){
if(s[0] != 'B'){
printf("%s\n", s);
}
}
if(len > 1){
for(i = 0; s[i]; i++){
if(i < len - 1){
if(s[i + 1] != 'B' && s[i] != 'B'){
putchar(s[i]);
p = 1;
}
}else if(i < len){
if(s[i] != 'B'){
putchar(s[i]);
p = 1;
}
}
}
printf("\n");
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:15:19: error: expected ';' before 'len'
15 | scanf("%s", s)
| ^
| ;
16 |
17 | len = strlen(s);
| ~~~
|
s671866247
|
p04030
|
C++
|
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define sz 12
char s[sz + 3];
int main(){
int i, j, len;
gets(s);
len = strlen(s);
if(len == 1){
puts(s);
}else{
for(i = 0; s[i]; i++){
if(s[i + 1] != 'B' && s[i] != 'B'){
putchar(s[i]);
}
}
printf("\n");
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:14:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
14 | gets(s);
| ^~~~
| getw
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.