submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s013392138
p00049
C++
#include<iostream> #include<stdio.h> #include<string> using namespace std; int main(){ int num;int blood_a=0,blood_b=0,blood_ab=0,blood_o=0; char blood_type[3]; while(scanf("%d,%s",&num,blood_type)){ if(blood_type=='A')blood_a++; else if(blood_type='B')blood_b++; else if(blood_type="AB")blood_ab++; else if(blood_type='O')blood_o++; } cout<<blood_a<<endl<<blood_b<<endl<<blood_ab<<endl<<blood_o<<endl; }
a.cc: In function 'int main()': a.cc:10:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | if(blood_type=='A')blood_a++; | ~~~~~~~~~~^~~~~ a.cc:11:25: error: incompatible types in assignment of 'char' to 'char [3]' 11 | else if(blood_type='B')blood_b++; | ~~~~~~~~~~^~~~ a.cc:12:25: error: invalid array assignment 12 | else if(blood_type="AB")blood_ab++; | ~~~~~~~~~~^~~~~ a.cc:13:25: error: incompatible types in assignment of 'char' to 'char [3]' 13 | else if(blood_type='O')blood_o++; | ~~~~~~~~~~^~~~
s417867025
p00049
C++
#include <cstdio> using namespace std; int main() { int A=0,B=0,C=0,D=0; int num; char bl; while (scanf("%d, %c",num,bl)!=EOF) { switch(bl) { case 'A': A++; break; case 'B'; B++; break; case 'AB': AB++; break; case 'O': O++; break; } } printf("%d\n%d\n%d\n%d\n",A,B,AB,O); }
a.cc:16:30: warning: multi-character character constant [-Wmultichar] 16 | case 'AB': | ^~~~ a.cc: In function 'int main()': a.cc:13:33: error: expected ':' before ';' token 13 | case 'B'; | ^ | : a.cc:17:33: error: 'AB' was not declared in this scope; did you mean 'B'? 17 | AB++; | ^~ | B a.cc:20:33: error: 'O' was not declared in this scope 20 | O++; | ^ a.cc:16:25: warning: case label value exceeds maximum value for type [-Wswitch-outside-range] 16 | case 'AB': | ^~~~ a.cc:24:39: error: 'AB' was not declared in this scope; did you mean 'B'? 24 | printf("%d\n%d\n%d\n%d\n",A,B,AB,O); | ^~ | B a.cc:24:42: error: 'O' was not declared in this scope 24 | printf("%d\n%d\n%d\n%d\n",A,B,AB,O); | ^
s503161216
p00049
C++
#include <cstdio> #include <string> using namespace std; int main() { int A=0,B=0,C=0,D=0; int num; string bl; while (scanf("%d, %s",num,bl)!=EOF) { switch(bl) { case "A": A++; break; case "B": B++; break; case "AB": C++; break; case "O": D++; break; } } printf("%d\n%d\n%d\n%d\n",A,B,C,D); }
a.cc: In function 'int main()': a.cc:10:24: error: switch quantity not an integer 10 | switch(bl) { | ^~
s090510355
p00049
C++
char a[999],b,c[9]; main(){for(;scanf("%d,%s",&b,c)+1;a[*c+c[1]]++);printf("%d\n%d\n%d\n%d\n",a[65],a[66],a[131],a[79]);}
a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 2 | main(){for(;scanf("%d,%s",&b,c)+1;a[*c+c[1]]++);printf("%d\n%d\n%d\n%d\n",a[65],a[66],a[131],a[79]);} | ^~~~ a.cc: In function 'int main()': a.cc:2:13: error: 'scanf' was not declared in this scope 2 | main(){for(;scanf("%d,%s",&b,c)+1;a[*c+c[1]]++);printf("%d\n%d\n%d\n%d\n",a[65],a[66],a[131],a[79]);} | ^~~~~ a.cc:2:49: error: 'printf' was not declared in this scope 2 | main(){for(;scanf("%d,%s",&b,c)+1;a[*c+c[1]]++);printf("%d\n%d\n%d\n%d\n",a[65],a[66],a[131],a[79]);} | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | char a[999],b,c[9];
s266244616
p00049
C++
char s[9];a[4];main(i){for(;~scanf("%*d,%s");)a[*s-65?*s-66?2:3:s[1]?4:1]++;for(;i<5;)printf("%d\n",a[i]);return 0;}
a.cc:1:11: error: 'a' does not name a type 1 | char s[9];a[4];main(i){for(;~scanf("%*d,%s");)a[*s-65?*s-66?2:3:s[1]?4:1]++;for(;i<5;)printf("%d\n",a[i]);return 0;} | ^ a.cc:1:20: error: expected constructor, destructor, or type conversion before '(' token 1 | char s[9];a[4];main(i){for(;~scanf("%*d,%s");)a[*s-65?*s-66?2:3:s[1]?4:1]++;for(;i<5;)printf("%d\n",a[i]);return 0;} | ^
s718642790
p00049
C++
c[];main(b){for(;~scanf("%d%s",&b,&b);++c[b%9]);printf("%d\n%d\n%d\n%d\n",c[7],c[2],c[1],*c);}
a.cc:1:1: error: 'c' does not name a type 1 | c[];main(b){for(;~scanf("%d%s",&b,&b);++c[b%9]);printf("%d\n%d\n%d\n%d\n",c[7],c[2],c[1],*c);} | ^ a.cc:1:9: error: expected constructor, destructor, or type conversion before '(' token 1 | c[];main(b){for(;~scanf("%d%s",&b,&b);++c[b%9]);printf("%d\n%d\n%d\n%d\n",c[7],c[2],c[1],*c);} | ^
s996269708
p00049
C++
main(a,b,c,d,e){printf("%d\n%d\n%d\n%d\n",b%10,c%10,d%10,e%10);}
a.cc:1:5: error: expected constructor, destructor, or type conversion before '(' token 1 | main(a,b,c,d,e){printf("%d\n%d\n%d\n%d\n",b%10,c%10,d%10,e%10);} | ^
s477971037
p00049
C++
x;main(){x=!puts("10\n6\n10\n0");}
a.cc:1:1: error: 'x' does not name a type 1 | x;main(){x=!puts("10\n6\n10\n0");} | ^ a.cc:1:3: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 1 | x;main(){x=!puts("10\n6\n10\n0");} | ^~~~ a.cc: In function 'int main()': a.cc:1:10: error: 'x' was not declared in this scope 1 | x;main(){x=!puts("10\n6\n10\n0");} | ^ a.cc:1:13: error: 'puts' was not declared in this scope 1 | x;main(){x=!puts("10\n6\n10\n0");} | ^~~~
s300148806
p00049
C++
main(){printf("10\n6\n10\n0");}
a.cc:1:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 1 | main(){printf("10\n6\n10\n0");} | ^~~~ a.cc: In function 'int main()': a.cc:1:8: error: 'printf' was not declared in this scope 1 | main(){printf("10\n6\n10\n0");} | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | main(){printf("10\n6\n10\n0");}
s950645415
p00049
C++
a;main(){a=!puts("10\n6\n10\n0");}
a.cc:1:1: error: 'a' does not name a type 1 | a;main(){a=!puts("10\n6\n10\n0");} | ^ a.cc:1:3: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 1 | a;main(){a=!puts("10\n6\n10\n0");} | ^~~~ a.cc: In function 'int main()': a.cc:1:10: error: 'a' was not declared in this scope 1 | a;main(){a=!puts("10\n6\n10\n0");} | ^ a.cc:1:13: error: 'puts' was not declared in this scope 1 | a;main(){a=!puts("10\n6\n10\n0");} | ^~~~
s044527451
p00049
C++
#include<cstdio> using namespace std; int answer[4]={0}; int main() { int n; char c[4]; while(scanf("%d,%s",&n,c)!=EOF) { if(c=="A") answer[0]++; if(c=="B")answer[1]++; if(c=="AB")answer[2]++; if(c=="O")answer[3]++; } for(int i=0;i<4;i++) { printf("%d\n",answer[i]):; } return 0; }
a.cc: In function 'int main()': a.cc:20:41: error: expected ';' before ':' token 20 | printf("%d\n",answer[i]):; | ^ | ;
s477507425
p00049
C++
#include <iostream> using namespace std; int main() { int x,y,z,a,b,ab,o; char w,v,q; while(cin>>x>>w>>v) { if(v == A)a++; else if(v==B){b++;} else if(v==AB){ab++;} else (v==o){o++;} } cout<<a<<endl; cout<<b<<endl; cout<<ab<<endl; cout<<o<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:11: error: 'A' was not declared in this scope 10 | if(v == A)a++; | ^ a.cc:11:14: error: 'B' was not declared in this scope 11 | else if(v==B){b++;} | ^ a.cc:12:14: error: 'AB' was not declared in this scope; did you mean 'ab'? 12 | else if(v==AB){ab++;} | ^~ | ab a.cc:13:14: error: expected ';' before '{' token 13 | else (v==o){o++;} | ^ | ;
s117693227
p00049
C++
#include <iostream> using namespace std; int main() { int x,y,z,a,b,ab,o; char w,v,q; while(cin>>x>>w>>v) { if(v == A;)a++; else if(v==B;){b++;} else if(v==AB;){ab++;} else (v==o;){o++;} } cout<<a<<endl; cout<<b<<endl; cout<<ab<<endl; cout<<o<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:11: error: 'A' was not declared in this scope 10 | if(v == A;)a++; | ^ a.cc:10:13: error: expected primary-expression before ')' token 10 | if(v == A;)a++; | ^ a.cc:11:14: error: 'B' was not declared in this scope 11 | else if(v==B;){b++;} | ^ a.cc:11:16: error: expected primary-expression before ')' token 11 | else if(v==B;){b++;} | ^ a.cc:12:14: error: 'AB' was not declared in this scope; did you mean 'ab'? 12 | else if(v==AB;){ab++;} | ^~ | ab a.cc:12:17: error: expected primary-expression before ')' token 12 | else if(v==AB;){ab++;} | ^ a.cc:13:13: error: expected ')' before ';' token 13 | else (v==o;){o++;} | ~ ^ | ) a.cc:13:14: error: expected primary-expression before ')' token 13 | else (v==o;){o++;} | ^
s449239726
p00049
C++
#include <iostream> using namespace std; &#160; int main() { &#160;&#160; &#160;&#160;int a = 0, b = 0, ab = 0, o = 0,x; char q,s; &#160;&#160;while(cin>>x>>q>>s) { &#160;&#160;&#160;&#160;if (s == "A") { &#160;&#160;&#160;&#160;&#160;&#160;a++; &#160;&#160;&#160;&#160;} else if (s == "B") { &#160;&#160;&#160;&#160;&#160;&#160;b++; &#160;&#160;&#160;&#160;} else if (s == "O") { &#160;&#160;&#160;&#160;&#160;&#160;o++; &#160;&#160;&#160;&#160;} else { &#160;&#160;&#160;&#160;&#160;&#160;ab++; &#160;&#160;&#160;&#160;} &#160;&#160;} &#160;&#160;cout << a << endl << b << endl << ab << endl << o << endl; &#160;&#160;return 0; }
a.cc:4:2: error: stray '#' in program 4 | &#160; | ^ a.cc:6:2: error: stray '#' in program 6 | &#160;&#160; | ^ a.cc:6:8: error: stray '#' in program 6 | &#160;&#160; | ^ a.cc:7:2: error: stray '#' in program 7 | &#160;&#160;int a = 0, b = 0, ab = 0, o = 0,x; | ^ a.cc:7:8: error: stray '#' in program 7 | &#160;&#160;int a = 0, b = 0, ab = 0, o = 0,x; | ^ a.cc:9:2: error: stray '#' in program 9 | &#160;&#160;while(cin>>x>>q>>s) | ^ a.cc:9:8: error: stray '#' in program 9 | &#160;&#160;while(cin>>x>>q>>s) | ^ a.cc:11:2: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;if (s == "A") { | ^ a.cc:11:8: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;if (s == "A") { | ^ a.cc:11:14: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;if (s == "A") { | ^ a.cc:11:20: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;if (s == "A") { | ^ a.cc:12:2: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:12:8: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:12:14: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:12:20: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:12:26: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:12:32: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:13:2: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^ a.cc:13:8: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^ a.cc:13:14: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^ a.cc:13:20: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^ a.cc:14:2: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:14:8: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:14:14: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:14:20: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:14:26: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:14:32: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:15:2: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;} else if (s == "O") { | ^ a.cc:15:8: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;} else if (s == "O") { | ^ a.cc:15:14: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;} else if (s == "O") { | ^ a.cc:15:20: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;} else if (s == "O") { | ^ a.cc:16:2: error: stray '#' in program 16 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:16:8: error: stray '#' in program 16 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:16:14: error: stray '#' in program 16 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:16:20: error: stray '#' in program 16 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:16:26: error: stray '#' in program 16 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:16:32: error: stray '#' in program 16 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:17:2: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;} else { | ^ a.cc:17:8: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;} else { | ^ a.cc:17:14: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;} else { | ^ a.cc:17:20: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;} else { | ^ a.cc:18:2: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:18:8: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:18:14: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:18:20: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:18:26: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:18:32: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:19:2: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;} | ^ a.cc:19:8: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;} | ^ a.cc:19:14: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;} | ^ a.cc:19:20: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;} | ^ a.cc:20:2: error: stray '#' in program 20 | &#160;&#160;} | ^ a.cc:20:8: error: stray '#' in program 20 | &#160;&#160;} | ^ a.cc:21:2: error: stray '#' in program 21 | &#160;&#160;cout << a << endl << b << endl << ab << endl << o << endl; | ^ a.cc:21:8: error: stray '#' in program 21 | &#160;&#160;cout << a << endl << b << endl << ab << endl << o << endl; | ^ a.cc:22:2: error: stray '#' in program 22 | &#160;&#160;return 0; | ^ a.cc:22:8: error: stray '#' in program 22 | &#160;&#160;return 0; | ^ a.cc:4:3: error: expected unqualified-id before numeric constant 4 | &#160; | ^~~ a.cc: In function 'int main()': a.cc:6:3: error: lvalue required as unary '&' operand 6 | &#160;&#160; | ^~~ a.cc:6:9: error: lvalue required as unary '&' operand 6 | &#160;&#160; | ^~~ a.cc:7:3: error: lvalue required as unary '&' operand 7 | &#160;&#160;int a = 0, b = 0, ab = 0, o = 0,x; | ^~~ a.cc:7:9: error: lvalue required as unary '&' operand 7 | &#160;&#160;int a = 0, b = 0, ab = 0, o = 0,x; | ^~~ a.cc:9:3: error: lvalue required as unary '&' operand 9 | &#160;&#160;while(cin>>x>>q>>s) | ^~~ a.cc:9:9: error: lvalue required as unary '&' operand 9 | &#160;&#160;while(cin>>x>>q>>s) | ^~~ a.cc:11:3: error: lvalue required as unary '&' operand 11 | &#160;&#160;&#160;&#160;if (s == "A") { | ^~~ a.cc:11:9: error: lvalue required as unary '&' operand 11 | &#160;&#160;&#160;&#160;if (s == "A") { | ^~~ a.cc:11:15: error: lvalue required as unary '&' operand 11 | &#160;&#160;&#160;&#160;if (s == "A") { | ^~~ a.cc:11:21: error: lvalue required as unary '&' operand 11 | &#160;&#160;&#160;&#160;if (s == "A") { | ^~~ a.cc:11:31: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | &#160;&#160;&#160;&#160;if (s == "A") { | ~~^~~~~~ a.cc:12:3: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:12:9: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:12:15: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:12:21: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:12:27: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:12:33: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:13:3: error: lvalue required as unary '&' operand 13 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^~~ a.cc:13:9: error: lvalue required as unary '&' operand 13 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^~~ a.cc:13:15: error: lvalue required as unary '&' operand 13 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^~~ a.cc:13:21: error: lvalue required as unary '&' operand 13 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^~~ a.cc:13:38: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ~~^~~~~~ a.cc:14:3: error: lvalue required as unary '&' operand 14 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^~~ a.cc:14:9: error: lvalue required as unary '&' operand 14 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^~~ a.cc:14:15: error: lvalue required as unary '&' operand 14 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^~~ a.cc:14:21: error: lvalue required as unary '&' operand 14 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^~~ a.cc:14:27: error: lvalue required as unary '&' operand 14 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^~~ a.cc:14:33: error: lvalue required as unary '&' operand 14 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^~~ a.cc:15:3: error: lvalue required as unary '&' operand 15 | &#160;&#160;&#160;&#160;} else if (s == "O") { | ^~~ a.cc:15:9: error: lvalue required as unary '&' operand 15 | &#160;&#160;&#160;&#160;} else if (s == "O") { | ^~~ a.cc:15:15: error: lvalue required as unary '&' operand 15 | &#160;&#160;&#160;&#160;} else if (s == "O") {
s260654662
p00049
C++
#include <iostream> #include <string> using namespace std; &#160; int main() { &#160;&#160;string str; &#160;&#160;int a = 0, b = 0, ab = 0, o = 0; &#160;&#160;while (getline(cin, str)) { &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); &#160;&#160;&#160;&#160;if (s == "A") { &#160;&#160;&#160;&#160;&#160;&#160;a++; &#160;&#160;&#160;&#160;} else if (s == "B") { &#160;&#160;&#160;&#160;&#160;&#160;b++; &#160;&#160;&#160;&#160;} else if (s == "O") { &#160;&#160;&#160;&#160;&#160;&#160;o++; &#160;&#160;&#160;&#160;} else { &#160;&#160;&#160;&#160;&#160;&#160;ab++; &#160;&#160;&#160;&#160;} &#160;&#160;} &#160;&#160;cout << a << endl << b << endl << ab << endl << o << endl; &#160;&#160;return 0; }
a.cc:4:2: error: stray '#' in program 4 | &#160; | ^ a.cc:6:2: error: stray '#' in program 6 | &#160;&#160;string str; | ^ a.cc:6:8: error: stray '#' in program 6 | &#160;&#160;string str; | ^ a.cc:7:2: error: stray '#' in program 7 | &#160;&#160;int a = 0, b = 0, ab = 0, o = 0; | ^ a.cc:7:8: error: stray '#' in program 7 | &#160;&#160;int a = 0, b = 0, ab = 0, o = 0; | ^ a.cc:8:2: error: stray '#' in program 8 | &#160;&#160;while (getline(cin, str)) { | ^ a.cc:8:8: error: stray '#' in program 8 | &#160;&#160;while (getline(cin, str)) { | ^ a.cc:9:2: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); | ^ a.cc:9:8: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); | ^ a.cc:9:14: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); | ^ a.cc:9:20: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); | ^ a.cc:10:2: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;if (s == "A") { | ^ a.cc:10:8: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;if (s == "A") { | ^ a.cc:10:14: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;if (s == "A") { | ^ a.cc:10:20: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;if (s == "A") { | ^ a.cc:11:2: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:11:8: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:11:14: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:11:20: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:11:26: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:11:32: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:12:2: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^ a.cc:12:8: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^ a.cc:12:14: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^ a.cc:12:20: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^ a.cc:13:2: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:13:8: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:13:14: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:13:20: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:13:26: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:13:32: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:14:2: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;} else if (s == "O") { | ^ a.cc:14:8: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;} else if (s == "O") { | ^ a.cc:14:14: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;} else if (s == "O") { | ^ a.cc:14:20: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;} else if (s == "O") { | ^ a.cc:15:2: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:15:8: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:15:14: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:15:20: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:15:26: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:15:32: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:16:2: error: stray '#' in program 16 | &#160;&#160;&#160;&#160;} else { | ^ a.cc:16:8: error: stray '#' in program 16 | &#160;&#160;&#160;&#160;} else { | ^ a.cc:16:14: error: stray '#' in program 16 | &#160;&#160;&#160;&#160;} else { | ^ a.cc:16:20: error: stray '#' in program 16 | &#160;&#160;&#160;&#160;} else { | ^ a.cc:17:2: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:17:8: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:17:14: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:17:20: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:17:26: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:17:32: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:18:2: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;} | ^ a.cc:18:8: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;} | ^ a.cc:18:14: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;} | ^ a.cc:18:20: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;} | ^ a.cc:19:2: error: stray '#' in program 19 | &#160;&#160;} | ^ a.cc:19:8: error: stray '#' in program 19 | &#160;&#160;} | ^ a.cc:20:2: error: stray '#' in program 20 | &#160;&#160;cout << a << endl << b << endl << ab << endl << o << endl; | ^ a.cc:20:8: error: stray '#' in program 20 | &#160;&#160;cout << a << endl << b << endl << ab << endl << o << endl; | ^ a.cc:21:2: error: stray '#' in program 21 | &#160;&#160;return 0; | ^ a.cc:21:8: error: stray '#' in program 21 | &#160;&#160;return 0; | ^ a.cc:4:3: error: expected unqualified-id before numeric constant 4 | &#160; | ^~~ a.cc: In function 'int main()': a.cc:6:3: error: lvalue required as unary '&' operand 6 | &#160;&#160;string str; | ^~~ a.cc:6:9: error: lvalue required as unary '&' operand 6 | &#160;&#160;string str; | ^~~ a.cc:7:3: error: lvalue required as unary '&' operand 7 | &#160;&#160;int a = 0, b = 0, ab = 0, o = 0; | ^~~ a.cc:7:9: error: lvalue required as unary '&' operand 7 | &#160;&#160;int a = 0, b = 0, ab = 0, o = 0; | ^~~ a.cc:8:3: error: lvalue required as unary '&' operand 8 | &#160;&#160;while (getline(cin, str)) { | ^~~ a.cc:8:9: error: lvalue required as unary '&' operand 8 | &#160;&#160;while (getline(cin, str)) { | ^~~ a.cc:9:3: error: lvalue required as unary '&' operand 9 | &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); | ^~~ a.cc:9:9: error: lvalue required as unary '&' operand 9 | &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); | ^~~ a.cc:9:15: error: lvalue required as unary '&' operand 9 | &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); | ^~~ a.cc:9:21: error: lvalue required as unary '&' operand 9 | &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); | ^~~ a.cc:10:3: error: lvalue required as unary '&' operand 10 | &#160;&#160;&#160;&#160;if (s == "A") { | ^~~ a.cc:10:9: error: lvalue required as unary '&' operand 10 | &#160;&#160;&#160;&#160;if (s == "A") { | ^~~ a.cc:10:15: error: lvalue required as unary '&' operand 10 | &#160;&#160;&#160;&#160;if (s == "A") { | ^~~ a.cc:10:21: error: lvalue required as unary '&' operand 10 | &#160;&#160;&#160;&#160;if (s == "A") { | ^~~ a.cc:11:3: error: lvalue required as unary '&' operand 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:11:9: error: lvalue required as unary '&' operand 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:11:15: error: lvalue required as unary '&' operand 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:11:21: error: lvalue required as unary '&' operand 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:11:27: error: lvalue required as unary '&' operand 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:11:33: error: lvalue required as unary '&' operand 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:12:3: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^~~ a.cc:12:9: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^~~ a.cc:12:15: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^~~ a.cc:12:21: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^~~ a.cc:13:3: error: lvalue required as unary '&' operand 13 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^~~ a.cc:13:9: error: lvalue required as unary '&' operand 13 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^~~ a.cc:13:15: error: lvalue required as unary '
s182381585
p00049
C++
#include <iostream> #include <string> using namespace std; &#160; int main() { &#160;&#160;string str; &#160;&#160;int a = 0, b = 0, ab = 0, o = 0; &#160;&#160;while (getline(cin, str)) { &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); &#160;&#160;&#160;&#160;if (s == "A") { &#160;&#160;&#160;&#160;&#160;&#160;a++; &#160;&#160;&#160;&#160;} else if (s == "B") { &#160;&#160;&#160;&#160;&#160;&#160;b++; &#160;&#160;&#160;&#160;} else if (s == "O") { &#160;&#160;&#160;&#160;&#160;&#160;o++; &#160;&#160;&#160;&#160;} else { &#160;&#160;&#160;&#160;&#160;&#160;ab++; &#160;&#160;&#160;&#160;} &#160;&#160;} &#160;&#160;cout << a << endl << b << endl << ab << endl << o << endl; &#160;&#160;return 0; }
a.cc:4:2: error: stray '#' in program 4 | &#160; | ^ a.cc:6:2: error: stray '#' in program 6 | &#160;&#160;string str; | ^ a.cc:6:8: error: stray '#' in program 6 | &#160;&#160;string str; | ^ a.cc:7:2: error: stray '#' in program 7 | &#160;&#160;int a = 0, b = 0, ab = 0, o = 0; | ^ a.cc:7:8: error: stray '#' in program 7 | &#160;&#160;int a = 0, b = 0, ab = 0, o = 0; | ^ a.cc:8:2: error: stray '#' in program 8 | &#160;&#160;while (getline(cin, str)) { | ^ a.cc:8:8: error: stray '#' in program 8 | &#160;&#160;while (getline(cin, str)) { | ^ a.cc:9:2: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); | ^ a.cc:9:8: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); | ^ a.cc:9:14: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); | ^ a.cc:9:20: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); | ^ a.cc:10:2: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;if (s == "A") { | ^ a.cc:10:8: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;if (s == "A") { | ^ a.cc:10:14: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;if (s == "A") { | ^ a.cc:10:20: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;if (s == "A") { | ^ a.cc:11:2: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:11:8: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:11:14: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:11:20: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:11:26: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:11:32: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^ a.cc:12:2: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^ a.cc:12:8: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^ a.cc:12:14: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^ a.cc:12:20: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^ a.cc:13:2: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:13:8: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:13:14: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:13:20: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:13:26: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:13:32: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^ a.cc:14:2: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;} else if (s == "O") { | ^ a.cc:14:8: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;} else if (s == "O") { | ^ a.cc:14:14: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;} else if (s == "O") { | ^ a.cc:14:20: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;} else if (s == "O") { | ^ a.cc:15:2: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:15:8: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:15:14: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:15:20: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:15:26: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:15:32: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;o++; | ^ a.cc:16:2: error: stray '#' in program 16 | &#160;&#160;&#160;&#160;} else { | ^ a.cc:16:8: error: stray '#' in program 16 | &#160;&#160;&#160;&#160;} else { | ^ a.cc:16:14: error: stray '#' in program 16 | &#160;&#160;&#160;&#160;} else { | ^ a.cc:16:20: error: stray '#' in program 16 | &#160;&#160;&#160;&#160;} else { | ^ a.cc:17:2: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:17:8: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:17:14: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:17:20: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:17:26: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:17:32: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;&#160;&#160;ab++; | ^ a.cc:18:2: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;} | ^ a.cc:18:8: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;} | ^ a.cc:18:14: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;} | ^ a.cc:18:20: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;} | ^ a.cc:19:2: error: stray '#' in program 19 | &#160;&#160;} | ^ a.cc:19:8: error: stray '#' in program 19 | &#160;&#160;} | ^ a.cc:20:2: error: stray '#' in program 20 | &#160;&#160;cout << a << endl << b << endl << ab << endl << o << endl; | ^ a.cc:20:8: error: stray '#' in program 20 | &#160;&#160;cout << a << endl << b << endl << ab << endl << o << endl; | ^ a.cc:21:2: error: stray '#' in program 21 | &#160;&#160;return 0; | ^ a.cc:21:8: error: stray '#' in program 21 | &#160;&#160;return 0; | ^ a.cc:4:3: error: expected unqualified-id before numeric constant 4 | &#160; | ^~~ a.cc: In function 'int main()': a.cc:6:3: error: lvalue required as unary '&' operand 6 | &#160;&#160;string str; | ^~~ a.cc:6:9: error: lvalue required as unary '&' operand 6 | &#160;&#160;string str; | ^~~ a.cc:7:3: error: lvalue required as unary '&' operand 7 | &#160;&#160;int a = 0, b = 0, ab = 0, o = 0; | ^~~ a.cc:7:9: error: lvalue required as unary '&' operand 7 | &#160;&#160;int a = 0, b = 0, ab = 0, o = 0; | ^~~ a.cc:8:3: error: lvalue required as unary '&' operand 8 | &#160;&#160;while (getline(cin, str)) { | ^~~ a.cc:8:9: error: lvalue required as unary '&' operand 8 | &#160;&#160;while (getline(cin, str)) { | ^~~ a.cc:9:3: error: lvalue required as unary '&' operand 9 | &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); | ^~~ a.cc:9:9: error: lvalue required as unary '&' operand 9 | &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); | ^~~ a.cc:9:15: error: lvalue required as unary '&' operand 9 | &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); | ^~~ a.cc:9:21: error: lvalue required as unary '&' operand 9 | &#160;&#160;&#160;&#160;string s = str.substr(str.find_first_of(",")+1); | ^~~ a.cc:10:3: error: lvalue required as unary '&' operand 10 | &#160;&#160;&#160;&#160;if (s == "A") { | ^~~ a.cc:10:9: error: lvalue required as unary '&' operand 10 | &#160;&#160;&#160;&#160;if (s == "A") { | ^~~ a.cc:10:15: error: lvalue required as unary '&' operand 10 | &#160;&#160;&#160;&#160;if (s == "A") { | ^~~ a.cc:10:21: error: lvalue required as unary '&' operand 10 | &#160;&#160;&#160;&#160;if (s == "A") { | ^~~ a.cc:11:3: error: lvalue required as unary '&' operand 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:11:9: error: lvalue required as unary '&' operand 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:11:15: error: lvalue required as unary '&' operand 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:11:21: error: lvalue required as unary '&' operand 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:11:27: error: lvalue required as unary '&' operand 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:11:33: error: lvalue required as unary '&' operand 11 | &#160;&#160;&#160;&#160;&#160;&#160;a++; | ^~~ a.cc:12:3: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^~~ a.cc:12:9: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^~~ a.cc:12:15: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^~~ a.cc:12:21: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;} else if (s == "B") { | ^~~ a.cc:13:3: error: lvalue required as unary '&' operand 13 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^~~ a.cc:13:9: error: lvalue required as unary '&' operand 13 | &#160;&#160;&#160;&#160;&#160;&#160;b++; | ^~~ a.cc:13:15: error: lvalue required as unary '
s526862296
p00049
C++
#include <iostream> #include <string> using namespace std; int main() { string str; int a = 0, b = 0, ab = 0, o = 0; while (getline(cin, str)) { string s = str.substr(str.find_first_of(",")+1); if (s == "A") { a++; } else if (s == "B") { b++; } else if (s == "O") { o++; } else { ab++; } } cout << a << endl << b << endl << ab << endl << o << endl; return 0; };}
a.cc:22:3: error: expected declaration before '}' token 22 | };} | ^
s842132084
p00049
C++
#include <iostream> #include <cstdio> #include <string> #include <map> using namespace std; int main() { int num; string row, blood; map<string, int> type; type.insert(make_pair("A", 0)); type.insert(make_pair("B", 0)); type.insert(make_pair("O", 0)); type.insert(make_pair("AB", 0)); while(cin>>row, !cin.eof()){ sscanf(row,"%d,%s", &num, &blood) type[blood]++; } cout<<type["A"]<<endl; cout<<type["B"]<<endl; cout<<type["O"]<<endl; cout<<type["AB"]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:17:24: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*' 17 | sscanf(row,"%d,%s", &num, &blood) | ^~~ | | | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/cstdio:42, from /usr/include/c++/14/ext/string_conversions.h:45, from /usr/include/c++/14/bits/basic_string.h:4154, 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/stdio.h:430:43: note: initializing argument 1 of 'int sscanf(const char*, const char*, ...)' 430 | extern int sscanf (const char *__restrict __s, | ~~~~~~~~~~~~~~~~~~~~~~~^~~
s216536970
p00049
C++
#include <iostream> #include <cstdio> #include <string> #include <map> using namespace std; int main() { int num; string row, blood; map<string, int> type; type.insert(make_pair("A", 0)); type.insert(make_pair("B", 0)); type.insert(make_pair("O", 0)); type.insert(make_pair("AB", 0)); while(cin>>row, !cin.eof()){ sscanf(row,"%d,%s", &num, &blood); type[blood]++; } cout<<type["A"]<<endl; cout<<type["B"]<<endl; cout<<type["O"]<<endl; cout<<type["AB"]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:17:24: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*' 17 | sscanf(row,"%d,%s", &num, &blood); | ^~~ | | | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/cstdio:42, from /usr/include/c++/14/ext/string_conversions.h:45, from /usr/include/c++/14/bits/basic_string.h:4154, 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/stdio.h:430:43: note: initializing argument 1 of 'int sscanf(const char*, const char*, ...)' 430 | extern int sscanf (const char *__restrict __s, | ~~~~~~~~~~~~~~~~~~~~~~~^~~
s627146839
p00049
C++
#include <iostream> #include <cstdio> #include <string> using namespace std; int main(){ char blood[3]; int num,a=0,b=0,o=0,ab=0; while(scanf("%d,%s",&num,blood) != EOF){ if(blood[0] == 'A' && blood[1] == '\0'){ a++; } else if(blood[0] == 'B'){ b++; } else if(blood[0] == 'O'){ o++; } else if(strcmp(blood,"AB") == 0){ ab++; } } cout << a << endl << b << endl << ab << endl << o << endl; }
a.cc: In function 'int main()': a.cc:19:13: error: 'strcmp' was not declared in this scope 19 | else if(strcmp(blood,"AB") == 0){ | ^~~~~~ a.cc:3:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <cstdio> +++ |+#include <cstring> 3 | #include <string>
s158423379
p00050
Java
import java.io.*; public class Main { public Main() { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); System.out.println(str.replace("apple", "xxxxx").replace("peach", "apple").replace("xxxxx", "peach")); br.close() } catch(IOException e) { System.out.println(e.getMessage()); } } public static void main(String[] args) { new Main(); } }
Main.java:9: error: ';' expected br.close() ^ 1 error
s788960455
p00050
Java
import java.util.Scanner; public class Main{ ????????????public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.nextLine(); str = str.replaceAll("apple", "aaaaa"); str = str.replaceAll("peach", "apple"); str = str.replaceAll("aaaaa", "peach"); System.out.println(str); } }
Main.java:3: error: illegal start of type ????????????public static void main(String[] args) { ^ 1 error
s316209633
p00050
Java
import java.util.*; class Main{ ????????????public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.nextLine(); str = str.replaceAll("apple", "aaaaa"); str = str.replaceAll("peach", "apple"); str = str.replaceAll("aaaaa", "peach"); System.out.println(str); } }
Main.java:3: error: illegal start of type ????????????public static void main(String[] args) { ^ 1 error
s848869696
p00050
Java
/* 正規表現は、[〇〇]を文字列形式で与える!! */ import java.util.*; public class Main0050{ static Scanner kbd = new Scanner(System.in); public static void main(String[] args){ String s = ""; // 生成中単語 String x; // 取得1文字 String sent = ""; // 出力文章 String in = kbd.nextLine(); // 入力文章 int i; for(i=0; i<in.length(); i++){ x = in.substring(i, i+1); if(!x.matches("[a-zA-Z]")){ //System.out.println(x); if(s.equals("apple")){ s = "peach"; } else if(s.equals("peach")){ s = "apple"; } sent += (s+x); s = ""; } else{ s += x; } } System.out.println(sent); } }
Main.java:5: error: class Main0050 is public, should be declared in a file named Main0050.java public class Main0050{ ^ 1 error
s649852201
p00050
Java
import java.util.*; public class Main{ Scanner kbd = new Scanner(System.in); public static void main(String[] args){ new Main0050().run(); } void run(){ while(kbd.hasNext()){ String x; // 取得1文字 StringBuffer sent = new StringBuffer(); // 出力文章 String in = kbd.nextLine(); // 入力文章 int i; for(i=0; i<in.length(); i++){ x = in.substring(i, i+1); if(x.equals("a") || x.equals("p")){ for(int k=0; k<4; k++){ i++; x += in.substring(i, i+1); } if(x.equals("apple")){ sent.append("peach"); } else if(x.equals("peach")){ sent.append("apple"); } else sent.append(x); } else sent.append(x); } System.out.println(sent); } } }
Main.java:5: error: cannot find symbol new Main0050().run(); ^ symbol: class Main0050 location: class Main 1 error
s519033354
p00050
Java
public class AppleAndPeach { public static void main(String args[]) throws Exception { System.out.println("input letters >"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input = br.readLine(); String output = input.replaceAll("peach","value"); output = output.replaceAll("apple", "peach"); output = output.replaceAll("value", "apple"); System.out.println(output); } }
Main.java:1: error: class AppleAndPeach is public, should be declared in a file named AppleAndPeach.java public class AppleAndPeach { ^ Main.java:6: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class AppleAndPeach Main.java:6: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class AppleAndPeach Main.java:6: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class AppleAndPeach 4 errors
s486573623
p00050
Java
public class Main { public static void main(String args[]) throws Exception { System.out.println("input letters >"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input = br.readLine(); String output = input.replaceAll("peach","value"); output = output.replaceAll("apple", "peach"); output = output.replaceAll("value", "apple"); System.out.println(output); } }
Main.java:6: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:6: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:6: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class Main 3 errors
s454872222
p00050
Java
public class Main { public static void Main(String args[]) throws Exception { System.out.println("input letters >"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input = br.readLine(); String output = input.replaceAll("peach","value"); output = output.replaceAll("apple", "peach"); output = output.replaceAll("value", "apple"); System.out.println(output); } }
Main.java:6: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:6: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:6: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class Main 3 errors
s636924777
p00050
Java
public class main { public static void main(String args[]) throws Exception { BufferedReader bn = new BufferedReader(new InputStreamReader(System.in)); String line; for(int i=0; i<Integer.parseInt(bn.readLine()); i++){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); line = br.readLine(); String str1 = line.replaceAll("apple", "テンプ"); String str2 = str1.replaceAll("peach", "apple"); String str3 = str2.replaceAll("テンプ", "peach"); System.out.println(str3); } } }
Main.java:1: error: class main is public, should be declared in a file named main.java public class main { ^ Main.java:3: error: cannot find symbol BufferedReader bn = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class main Main.java:3: error: cannot find symbol BufferedReader bn = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class main Main.java:3: error: cannot find symbol BufferedReader bn = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class main Main.java:8: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class main Main.java:8: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class main Main.java:8: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class main 7 errors
s460359712
p00050
Java
public class Main { public static void main(String args[]) { BufferedReader bn = new BufferedReader(new InputStreamReader(System.in)); String line; for(int i=0; i<Integer.parseInt(bn.readLine()); i++){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); line = br.readLine(); String str1 = line.replaceAll("apple", "テンプ"); String str2 = str1.replaceAll("peach", "apple"); String str3 = str2.replaceAll("テンプ", "peach"); System.out.println(str3); } } }
Main.java:3: error: cannot find symbol BufferedReader bn = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:3: error: cannot find symbol BufferedReader bn = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:3: error: cannot find symbol BufferedReader bn = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class Main Main.java:8: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:8: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:8: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class Main 6 errors
s643283218
p00050
Java
public static void Main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); sentence = br.readLine(); sentence = sentence.replaceAll("peach","リンゴ"); sentence = sentence.replaceAll("apple","peach"); sentence = sentence.replaceAll("リンゴ","apple"); System.out.println(sentence); }
Main.java:1: error: unnamed classes are a preview feature and are disabled by default. public static void Main(String args[]) throws Exception { ^ (use --enable-preview to enable unnamed classes) 1 error
s153301509
p00050
Java
public class Main { public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line=br.readLine(); line = line.replace("apple","fujita-"); line = line.replace("peach","ikeda-"); line = line.replace("fujita-","peach"); line = line.replace("ikeda-","apple"); System.out.println(line); } }
Main.java:4: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:4: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:4: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class Main 3 errors
s933022292
p00050
Java
public class Main { public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line; line = br.readLine(); String str1 = line.replaceAll("apple", "テンプ"); String str2 = str1.replaceAll("peach", "apple"); String str3 = str2.replaceAll("テンプ", "peach"); System.out.println(str3); } }
Main.java:3: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:3: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:3: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class Main 3 errors
s154669728
p00050
Java
public class Main { private static String sentence; public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); sentence = br.readLine(); sentence = sentence.replaceAll("peach","リンゴ"); sentence = sentence.replaceAll("apple","peach"); sentence = sentence.replaceAll("リンゴ","apple"); System.out.println(sentence); } }
Main.java:5: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:5: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:5: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class Main 3 errors
s502073222
p00050
Java
package tips; import java.io.BufferedReader; import java.io.InputStreamReader; public class AandP { public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = br.readLine(); line = line.replaceAll("apple", "XXXXX"); line = line.replaceAll("peach", "yyyyy"); line = line.replaceAll("XXXXX", "peach"); line = line.replaceAll("yyyyy", "apple"); System.out.println(line); } }
Main.java:6: error: class AandP is public, should be declared in a file named AandP.java public class AandP { ^ 1 error
s426555911
p00050
C
#include <stdio.h> int main(void){ char str[1000]; int i; int l; scanf("%s",str)); l=strlen(str); for(i=0;i<=l;i++){ if(str[i]=='a' && str[i+1]=='p' && str[i+2]=='p' && str[i+3]=='l' && str[i+4]=='e'){ str[i]='p'; str[i+1]='e'; str[i+2]='a'; str[i+3]='c'; str[i+4]='h'; } else if(str[i]=='p' && str[i+1]=='e' && str[i+2]=='a' && str[i+3]=='c' && str[i+4]=='h'){ str[i]='a'; str[i+1]='p'; str[i+2]='p'; str[i+3]='l'; str[i+4]='e'; } printf("%c",str[i]); } printf("\n"); }
main.c: In function 'main': main.c:6:24: error: expected ';' before ')' token 6 | scanf("%s",str)); | ^ | ; main.c:6:24: error: expected statement before ')' token main.c:7:11: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] 7 | l=strlen(str); | ^~~~~~ main.c:2:1: note: include '<string.h>' or provide a declaration of 'strlen' 1 | #include <stdio.h> +++ |+#include <string.h> 2 | int main(void){ main.c:7:11: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] 7 | l=strlen(str); | ^~~~~~ main.c:7:11: note: include '<string.h>' or provide a declaration of 'strlen'
s823084277
p00050
C
// AOJ Volume 0 Problem 0050 #include <stdio.h> #include <string.h> int main(void) { char str_in[2000]; char str_out[2000]; char *p_in, *p_out; gets(str_in, 2000, stdin); str_out[0] = '\0'; p_in = str_in; p_out = str_out; while (*p_in != '\0'){ if (strncmp(p_in, "apple", strlen("apple")) == 0){ strcat(p_out, "peach"); p_out += 5; p_in += 5; } else if (strncmp(p_in, "peach", strlen("peach")) == 0){ strcat(p_out, "apple"); p_out += 5; p_in += 5; } else { *p_out++ = *p_in++; } } *p_out = '\0'; printf("%s", str_out); return (0); }
main.c: In function 'main': main.c:12:5: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration] 12 | gets(str_in, 2000, stdin); | ^~~~ | fgets
s833319545
p00050
C
package solve; import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); String str = "" , all = ""; boolean Eflag = false; while ( sc.hasNext() ) { str = sc.next(); String tmp = ""; char c; for ( int i = 0; i < str.length(); i++ ) { c = str.charAt(i); if ( c != '.' ) tmp += str.charAt(i); else Eflag = true; } if ( tmp.equals("apple")) tmp = "peach"; else if ( tmp.equals("peach") ) tmp = "apple"; if ( Eflag == true ) all += tmp+"."; else all += tmp+" "; System.out.println(all); } } }
main.c:1:1: error: unknown type name 'package' 1 | package solve; | ^~~~~~~ main.c:2:1: error: unknown type name 'import' 2 | import java.util.*; | ^~~~~~ main.c:2:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 2 | import java.util.*; | ^ main.c:4:1: error: unknown type name 'public' 4 | public class Main { | ^~~~~~ main.c:4:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main' 4 | public class Main { | ^~~~
s828506191
p00050
C
#include<stdio.h> int main() { char str[1000]; int i=0; gets(str); while(str[i+4]!='\0') { if(str[i]=='a') { if(str[i+1]=='p') { if(str[i+2]=='p') { if(str[i+3]=='l') { if(str[i+4]=='e') { str[i]='p'; str[i+1]='e'; str[i+2]='a'; str[i+3]='c'; str[i+4]='h'; } } } } } else if(str[i]=='p') { if(str[i+1]=='e') { if(str[i+2]=='a') { if(str[i+3]=='c') { if(str[i+4]=='h') { str[i]='a'; str[i+1]='p'; str[i+2]='p'; str[i+3]='l'; str[i+4]='e'; } } } } } i++; } printf("%s",str); return 0; }
main.c: In function 'main': main.c:8:9: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration] 8 | gets(str); | ^~~~ | fgets
s020446527
p00050
C
import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); while(true){ String data = scan.next(); if(data.equals("apple")){ System.out.print("peach "); }else if(data.equals("peach")){ System.out.print("apple "); }else{ int length = data.length(); if(data.charAt(length-1)=='.'){ if(data.substring(0, length-1).equals("apple")){ System.out.print("peach"); }else if(data.substring(0, length-2).equals("paech")){ System.out.print("apple"); } System.out.println("."); break; } System.out.print(data + " "); } } } }
main.c:1:1: error: unknown type name 'import' 1 | import java.util.Scanner; | ^~~~~~ main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 1 | import java.util.Scanner; | ^ main.c:3:1: error: unknown type name 'class' 3 | class Main{ | ^~~~~ main.c:3:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token 3 | class Main{ | ^
s595016883
p00050
C
int main(void){ char text[100],punc; int i=0,j,n; while(scanf("%s",text)!=EOF){ n=strlen(text);punc=0; if(ispunct(text[n-1])){punc=text[n-1];text[n-1]='\0';} if(strcmp(text,"apple")==0)strcpy(text,"peach"); else if(strcmp(text,"apples")==0)strcpy(text,"peaches"); else if(strcmp(text,"Apple")==0)strcpy(text,"Peach"); else if(strcmp(text,"Apples")==0)strcpy(text,"Peaches"); else if(strcmp(text,"peach")==0)strcpy(text,"apple"); else if(strcmp(text,"peaches")==0)strcpy(text,"apples"); else if(strcmp(text,"Peach")==0)strcpy(text,"Apple"); else if(strcmp(text,"Peaches")==0)strcpy(text,"Apples"); if(i==0)i++; else printf(" "); printf("%s",text); if(punc>0)printf("%c",punc); } printf("\n"); return 0; }
main.c: In function 'main': main.c:4:15: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 4 | while(scanf("%s",text)!=EOF){ | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | int main(void){ main.c:4:15: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 4 | while(scanf("%s",text)!=EOF){ | ^~~~~ main.c:4:15: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:4:33: error: 'EOF' undeclared (first use in this function) 4 | while(scanf("%s",text)!=EOF){ | ^~~ main.c:4:33: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>' main.c:4:33: note: each undeclared identifier is reported only once for each function it appears in main.c:5:19: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] 5 | n=strlen(text);punc=0; | ^~~~~~ main.c:1:1: note: include '<string.h>' or provide a declaration of 'strlen' +++ |+#include <string.h> 1 | int main(void){ main.c:5:19: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] 5 | n=strlen(text);punc=0; | ^~~~~~ main.c:5:19: note: include '<string.h>' or provide a declaration of 'strlen' main.c:6:20: error: implicit declaration of function 'ispunct' [-Wimplicit-function-declaration] 6 | if(ispunct(text[n-1])){punc=text[n-1];text[n-1]='\0';} | ^~~~~~~ main.c:1:1: note: include '<ctype.h>' or provide a declaration of 'ispunct' +++ |+#include <ctype.h> 1 | int main(void){ main.c:8:20: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration] 8 | if(strcmp(text,"apple")==0)strcpy(text,"peach"); | ^~~~~~ main.c:8:20: note: include '<string.h>' or provide a declaration of 'strcmp' main.c:8:44: error: implicit declaration of function 'strcpy' [-Wimplicit-function-declaration] 8 | if(strcmp(text,"apple")==0)strcpy(text,"peach"); | ^~~~~~ main.c:8:44: note: include '<string.h>' or provide a declaration of 'strcpy' main.c:8:44: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch] main.c:8:44: note: include '<string.h>' or provide a declaration of 'strcpy' main.c:9:50: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch] 9 | else if(strcmp(text,"apples")==0)strcpy(text,"peaches"); | ^~~~~~ main.c:9:50: note: include '<string.h>' or provide a declaration of 'strcpy' main.c:10:49: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch] 10 | else if(strcmp(text,"Apple")==0)strcpy(text,"Peach"); | ^~~~~~ main.c:10:49: note: include '<string.h>' or provide a declaration of 'strcpy' main.c:11:50: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch] 11 | else if(strcmp(text,"Apples")==0)strcpy(text,"Peaches"); | ^~~~~~ main.c:11:50: note: include '<string.h>' or provide a declaration of 'strcpy' main.c:12:49: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch] 12 | else if(strcmp(text,"peach")==0)strcpy(text,"apple"); | ^~~~~~ main.c:12:49: note: include '<string.h>' or provide a declaration of 'strcpy' main.c:13:51: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch] 13 | else if(strcmp(text,"peaches")==0)strcpy(text,"apples"); | ^~~~~~ main.c:13:51: note: include '<string.h>' or provide a declaration of 'strcpy' main.c:14:49: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch] 14 | else if(strcmp(text,"Peach")==0)strcpy(text,"Apple"); | ^~~~~~ main.c:14:49: note: include '<string.h>' or provide a declaration of 'strcpy' main.c:15:51: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch] 15 | else if(strcmp(text,"Peaches")==0)strcpy(text,"Apples"); | ^~~~~~ main.c:15:51: note: include '<string.h>' or provide a declaration of 'strcpy' main.c:17:35: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 17 | if(i==0)i++; else printf(" "); | ^~~~~~ main.c:17:35: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:17:35: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:17:35: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:18:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] 18 | printf("%s",text); | ^~~~~~ main.c:18:17: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:21:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] 21 | printf("\n"); | ^~~~~~ main.c:21:9: note: include '<stdio.h>' or provide a declaration of 'printf'
s781788393
p00050
C
int main(void){ char text[1024]; int i,n; fgets(text,1024,stdin); n=strlen(text); for(i=0;i<n-5;i++){ if((isspace(text[i]) || ispunct(text[i])) && (isspace(text[i+6]) || ispunct(text[i+6]))){ i++; if(text[i]=='a' && text[i+1]=='p' && text[i+2]=='p' && text[i+3]=='l' && text[i+4]=='e'){ text[i]='p';text[i+1]='e';text[i+2]='a';text[i+3]='c';text[i+4]='h'; } else if(text[i]=='p' && text[i+1]=='e' && text[i+2]=='a' && text[i+3]=='c' && text[i+4]=='h'){ text[i]='a';text[i+1]='p';text[i+2]='p';text[i+3]='l';text[i+4]='e'; } else if(text[i]=='A' && text[i+1]=='p' && text[i+2]=='p' && text[i+3]=='l' && text[i+4]=='e'){ text[i]='P';text[i+1]='e';text[i+2]='a';text[i+3]='c';text[i+4]='h'; } else if(text[i]=='P' && text[i+1]=='e' && text[i+2]=='a' && text[i+3]=='c' && text[i+4]=='h'){ text[i]='A';text[i+1]='p';text[i+2]='p';text[i+3]='l';text[i+4]='e'; } else if(text[i]=='A' && text[i+1]=='P' && text[i+2]=='P' && text[i+3]=='L' && text[i+4]=='E'){ text[i]='P';text[i+1]='E';text[i+2]='A';text[i+3]='C';text[i+4]='H';return 1; } else if(text[i]=='P' && text[i+1]=='E' && text[i+2]=='A' && text[i+3]=='C' && text[i+4]=='H'){ text[i]='A';text[i+1]='P';text[i+2]='P';text[i+3]='L';text[i+4]='E';return 1; } } } printf("%s",text); return 0; }
main.c: In function 'main': main.c:4:9: error: implicit declaration of function 'fgets' [-Wimplicit-function-declaration] 4 | fgets(text,1024,stdin); | ^~~~~ main.c:4:25: error: 'stdin' undeclared (first use in this function) 4 | fgets(text,1024,stdin); | ^~~~~ main.c:1:1: note: 'stdin' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>' +++ |+#include <stdio.h> 1 | int main(void){ main.c:4:25: note: each undeclared identifier is reported only once for each function it appears in 4 | fgets(text,1024,stdin); | ^~~~~ main.c:5:11: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] 5 | n=strlen(text); | ^~~~~~ main.c:1:1: note: include '<string.h>' or provide a declaration of 'strlen' +++ |+#include <string.h> 1 | int main(void){ main.c:5:11: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] 5 | n=strlen(text); | ^~~~~~ main.c:5:11: note: include '<string.h>' or provide a declaration of 'strlen' main.c:7:21: error: implicit declaration of function 'isspace' [-Wimplicit-function-declaration] 7 | if((isspace(text[i]) || ispunct(text[i])) && (isspace(text[i+6]) || ispunct(text[i+6]))){ | ^~~~~~~ main.c:1:1: note: include '<ctype.h>' or provide a declaration of 'isspace' +++ |+#include <ctype.h> 1 | int main(void){ main.c:7:41: error: implicit declaration of function 'ispunct' [-Wimplicit-function-declaration] 7 | if((isspace(text[i]) || ispunct(text[i])) && (isspace(text[i+6]) || ispunct(text[i+6]))){ | ^~~~~~~ main.c:7:41: note: include '<ctype.h>' or provide a declaration of 'ispunct' main.c:29:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 29 | printf("%s",text); | ^~~~~~ main.c:29:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:29:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:29:9: note: include '<stdio.h>' or provide a declaration of 'printf'
s780543584
p00050
C
int main(void){ char text[1024]; int i,n; fgets(text,1024,stdin); n=strlen(text); for(i=0;i<n-5;i++){ if((isspace(text[i]) || ispunct(text[i])) && (isspace(text[i+6]) || ispunct(text[i+6]))){ i++; if(text[i]=='a' && text[i+1]=='p' && text[i+2]=='p' && text[i+3]=='l' && text[i+4]=='e'){ text[i]='p';text[i+1]='e';text[i+2]='a';text[i+3]='c';text[i+4]='h'; } else if(text[i]=='p' && text[i+1]=='e' && text[i+2]=='a' && text[i+3]=='c' && text[i+4]=='h'){ text[i]='a';text[i+1]='p';text[i+2]='p';text[i+3]='l';text[i+4]='e'; } else if(text[i]=='A' && text[i+1]=='p' && text[i+2]=='p' && text[i+3]=='l' && text[i+4]=='e'){ text[i]='P';text[i+1]='e';text[i+2]='a';text[i+3]='c';text[i+4]='h';return 1; } else if(text[i]=='P' && text[i+1]=='e' && text[i+2]=='a' && text[i+3]=='c' && text[i+4]=='h'){ text[i]='A';text[i+1]='p';text[i+2]='p';text[i+3]='l';text[i+4]='e';return 1; } } } printf("%s",text); return 0; }
main.c: In function 'main': main.c:4:9: error: implicit declaration of function 'fgets' [-Wimplicit-function-declaration] 4 | fgets(text,1024,stdin); | ^~~~~ main.c:4:25: error: 'stdin' undeclared (first use in this function) 4 | fgets(text,1024,stdin); | ^~~~~ main.c:1:1: note: 'stdin' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>' +++ |+#include <stdio.h> 1 | int main(void){ main.c:4:25: note: each undeclared identifier is reported only once for each function it appears in 4 | fgets(text,1024,stdin); | ^~~~~ main.c:5:11: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] 5 | n=strlen(text); | ^~~~~~ main.c:1:1: note: include '<string.h>' or provide a declaration of 'strlen' +++ |+#include <string.h> 1 | int main(void){ main.c:5:11: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] 5 | n=strlen(text); | ^~~~~~ main.c:5:11: note: include '<string.h>' or provide a declaration of 'strlen' main.c:7:21: error: implicit declaration of function 'isspace' [-Wimplicit-function-declaration] 7 | if((isspace(text[i]) || ispunct(text[i])) && (isspace(text[i+6]) || ispunct(text[i+6]))){ | ^~~~~~~ main.c:1:1: note: include '<ctype.h>' or provide a declaration of 'isspace' +++ |+#include <ctype.h> 1 | int main(void){ main.c:7:41: error: implicit declaration of function 'ispunct' [-Wimplicit-function-declaration] 7 | if((isspace(text[i]) || ispunct(text[i])) && (isspace(text[i+6]) || ispunct(text[i+6]))){ | ^~~~~~~ main.c:7:41: note: include '<ctype.h>' or provide a declaration of 'ispunct' main.c:23:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 23 | printf("%s",text); | ^~~~~~ main.c:23:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:23:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:23:9: note: include '<stdio.h>' or provide a declaration of 'printf'
s705924965
p00050
C
#include <stdio.h> int problem0050(){ int start_apple[200],start_peach[200],flag1=0,flag2=0,judge1=0,judge2=0,i,j,k; char alternative[]="pop'n"; char apple[]="apple"; char peach[]="peach"; char buf[1001]; fgets(buf,1000,stdin); for(i=0;i<996;i++){ for(j=0;j<5;j++){ if(buf[i+j]==apple[j]){judge1++;} if(buf[i+j]==peach[j]){judge2++;} } if(judge1==5){start_apple[flag1]=i; flag1++; judge1=0; judge2=0;} else if(judge2==5){start_peach[flag2]=i; flag2++; judge1=0; judge2=0;} else{judge1=0; judge2=0;} } for(j=0;j<5;j++){ for(k=0;k<flag1;k++){ if(start_apple[0]==0&&flag1==0)break; buf[start_apple[k]+j]=peach[j]; } for(k=0;k<flag2;k++){ if(start_peach[0]==0&&flag2==0)break; buf[start_peach[k]+j]=apple[j]; } } buf[1000]='\n'; printf("%s",buf); return 0; }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s782266137
p00050
C
#include <stdio.h> #include <string.h> int main(){ char str[2000]; int i, j; fgets(str, 2000, stdin); for(i = 0;i < strlen(str);i++){ if(strncmp(&str[i], "apple", 5) == 0)strncpy(&str[i], "peach", 5); else if(strncmp(&str[i], "peach", 5) == 0) strncpy(&str[i],"apple", 5); printf("%s ", str); } puts("%s", str); return 0; }
main.c: In function 'main': main.c:13:3: error: too many arguments to function 'puts' 13 | puts("%s", str); | ^~~~ In file included from main.c:1: /usr/include/stdio.h:714:12: note: declared here 714 | extern int puts (const char *__s); | ^~~~
s098555980
p00050
C
int main(void) { char str[1000]; const char *apple = "apple"; const char *peach = "peach"; int i; fgets(str, 1000, stdin); for (i = 0; str[i] != 0; i++){ if (strncmp(&str[i], apple, 5) == 0){ strncpy(str + i, peach, 5); } else if (strncmp(&str[i], peach, 5) == 0){ strncpy(str + i, apple, 5); } } puts(str); return 0; }
main.c: In function 'main': main.c:8:9: error: implicit declaration of function 'fgets' [-Wimplicit-function-declaration] 8 | fgets(str, 1000, stdin); | ^~~~~ main.c:8:26: error: 'stdin' undeclared (first use in this function) 8 | fgets(str, 1000, stdin); | ^~~~~ main.c:1:1: note: 'stdin' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>' +++ |+#include <stdio.h> 1 | int main(void) main.c:8:26: note: each undeclared identifier is reported only once for each function it appears in 8 | fgets(str, 1000, stdin); | ^~~~~ main.c:10:21: error: implicit declaration of function 'strncmp' [-Wimplicit-function-declaration] 10 | if (strncmp(&str[i], apple, 5) == 0){ | ^~~~~~~ main.c:1:1: note: include '<string.h>' or provide a declaration of 'strncmp' +++ |+#include <string.h> 1 | int main(void) main.c:10:45: warning: 'strncmp' argument 3 type is 'int' where 'long unsigned int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch] 10 | if (strncmp(&str[i], apple, 5) == 0){ | ^ <built-in>: note: built-in 'strncmp' declared here main.c:11:25: error: implicit declaration of function 'strncpy' [-Wimplicit-function-declaration] 11 | strncpy(str + i, peach, 5); | ^~~~~~~ main.c:11:25: note: include '<string.h>' or provide a declaration of 'strncpy' main.c:11:25: warning: incompatible implicit declaration of built-in function 'strncpy' [-Wbuiltin-declaration-mismatch] main.c:11:25: note: include '<string.h>' or provide a declaration of 'strncpy' main.c:13:50: warning: 'strncmp' argument 3 type is 'int' where 'long unsigned int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch] 13 | else if (strncmp(&str[i], peach, 5) == 0){ | ^ <built-in>: note: built-in 'strncmp' declared here main.c:14:25: warning: incompatible implicit declaration of built-in function 'strncpy' [-Wbuiltin-declaration-mismatch] 14 | strncpy(str + i, apple, 5); | ^~~~~~~ main.c:14:25: note: include '<string.h>' or provide a declaration of 'strncpy' main.c:17:9: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 17 | puts(str); | ^~~~ main.c:17:9: note: include '<stdio.h>' or provide a declaration of 'puts'
s983660557
p00050
C
#include<stdio.h> int main(void){ int i,j,n,m; char a[1000]; gets(a); for(i=0;i<1000;i++){ int f=0; if(a[i]=='p' if(a[i+1]=='e')if(a[i+2]=='a')if(a[i+3]=='c')a[i+4]=='h')f=1; if(f==1){ a[i]='a'; a[i+1]='p'; a[i+2]='p'; a[i+3]='l'; a[i+4]='e'; i+=4; continue; } if(a[i]=='a')if(a[i+1]=='p')if(a[i+2]=='p')if(a[i+3]=='l')if(a[i+4]=='e')f=1; if(f==1){ a[i]='p'; a[i+1]='e'; a[i+2]='a'; a[i+3]='c'; a[i+4]='h'; i+=4; } } printf("%s",a); return 0; }
main.c: In function 'main': main.c:5:4: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration] 5 | gets(a); | ^~~~ | fgets main.c:8:19: error: expected ')' before 'if' 8 | if(a[i]=='p' | ~ ^ | ) 9 | if(a[i+1]=='e')if(a[i+2]=='a')if(a[i+3]=='c')a[i+4]=='h')f=1; | ~~
s842199313
p00050
C++
#include "pch.h" #include <iostream> #include <string> using namespace std; int main() { string x; string a = "apple"; string b = "peach"; string c = "apple."; string d = "peach."; cin >> x; if (x == a) { string x = "peach"; } if (x == b) { string x = "apple"; } if (x == c) { string x = "peach."; } if (x == d) { string x = "apple."; } cout << x; while (cin >> x) { if (x == a) { string x = "peach"; } if (x == b) { string x = "apple"; } if (x == c) { string x = "peach."; } if (x == d) { string x = "apple."; } cout << " " << x; } cout << endl; }
a.cc:1:10: fatal error: pch.h: No such file or directory 1 | #include "pch.h" | ^~~~~~~ compilation terminated.
s968876540
p00050
C++
#include<iostream> #include<cstdio> #include<string> #include<algorithm> using namespace std; int main(){ char input[1001]; cin.getline(input, 1000); for (int i = 0; input[i] != '\n'; i++){ if (!strncmp(&input[i], "apple", 5)){ strncpy(&input[i], "peach", 5); } else if (!strncmp(&input[i], "peach", 5)){ strncpy(&input[i], "apple", 5); } } printf("%s\n", input); return 0; }
a.cc: In function 'int main()': a.cc:11:22: error: 'strncmp' was not declared in this scope 11 | if (!strncmp(&input[i], "apple", 5)){ | ^~~~~~~ a.cc:5:1: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include<algorithm> +++ |+#include <cstring> 5 | using namespace std; a.cc:12:25: error: 'strncpy' was not declared in this scope 12 | strncpy(&input[i], "peach", 5); | ^~~~~~~ a.cc:12:25: note: 'strncpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:15:25: error: 'strncpy' was not declared in this scope 15 | strncpy(&input[i], "apple", 5); | ^~~~~~~ a.cc:15:25: note: 'strncpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s084629459
p00050
C++
#include<iostream> #include<cstdio> #include<string> #include<algorithm> using namespace std; int main(){ char input[2000]; cin.getline(input, 1000); for (int i = 0; input[i] != '\0'; i++){ if (!strncmp(&input[i], "apple", 5)){ strncpy(&input[i], "peach", 5); } else if (!strncmp(&input[i], "peach", 5)){ strncpy(&input[i], "apple", 5); } } printf("%s\n", input); return 0; }
a.cc: In function 'int main()': a.cc:11:22: error: 'strncmp' was not declared in this scope 11 | if (!strncmp(&input[i], "apple", 5)){ | ^~~~~~~ a.cc:5:1: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include<algorithm> +++ |+#include <cstring> 5 | using namespace std; a.cc:12:25: error: 'strncpy' was not declared in this scope 12 | strncpy(&input[i], "peach", 5); | ^~~~~~~ a.cc:12:25: note: 'strncpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:15:25: error: 'strncpy' was not declared in this scope 15 | strncpy(&input[i], "apple", 5); | ^~~~~~~ a.cc:15:25: note: 'strncpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s034970726
p00050
C++
int main() { string str; getline(cin, str); stringstream ss(str); while (!ss.eof()) { ss >> str; int n = str.length() - 1; char last = str[n]; if (!isalpha(last)) { str.erase(n); } else { last = '\0'; } if (str == "apple") { cout << "peach"; } else if (str == "peach") { cout << "apple"; } else { cout << str; } if (last) { cout << last; } cout << (!ss.eof() ? ' ' : '\n'); } return 0; }
a.cc: In function 'int main()': a.cc:2:9: error: 'string' was not declared in this scope 2 | string str; | ^~~~~~ a.cc:3:17: error: 'cin' was not declared in this scope 3 | getline(cin, str); | ^~~ a.cc:3:22: error: 'str' was not declared in this scope; did you mean 'std'? 3 | getline(cin, str); | ^~~ | std a.cc:3:9: error: 'getline' was not declared in this scope 3 | getline(cin, str); | ^~~~~~~ a.cc:4:9: error: 'stringstream' was not declared in this scope 4 | stringstream ss(str); | ^~~~~~~~~~~~ a.cc:6:17: error: 'ss' was not declared in this scope 6 | while (!ss.eof()) { | ^~ a.cc:10:22: error: 'isalpha' was not declared in this scope 10 | if (!isalpha(last)) { | ^~~~~~~ a.cc:17:25: error: 'cout' was not declared in this scope 17 | cout << "peach"; | ^~~~ a.cc:20:25: error: 'cout' was not declared in this scope 20 | cout << "apple"; | ^~~~ a.cc:23:25: error: 'cout' was not declared in this scope 23 | cout << str; | ^~~~ a.cc:26:25: error: 'cout' was not declared in this scope 26 | cout << last; | ^~~~ a.cc:28:17: error: 'cout' was not declared in this scope 28 | cout << (!ss.eof() ? ' ' : '\n'); | ^~~~
s781998158
p00050
C++
#include <iostream> #include <string> #include <sstream> #include <regex> using namespace std; int main() { string str; getline(cin, str); stringstream ss(str); while (!ss.eof()) { ss >> str; string tmp = ""; tmp = regex_replace(str,"apple", "peach"); if (str == tmp) { tmp = regex_replace(str, "peach", "apple"); } cout << tmp << (!ss.eof() ? ' ' : '\n'); } return 0; }
a.cc: In function 'int main()': a.cc:17:36: error: no matching function for call to 'regex_replace(std::string&, const char [6], const char [6])' 17 | tmp = regex_replace(str,"apple", "peach"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/regex:68, from a.cc:4: /usr/include/c++/14/bits/regex.h:2576:5: note: candidate: 'template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type, class _St, class _Sa> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const __cxx11::basic_string<_Ch_type, _St, _Sa>&, regex_constants::match_flag_type)' 2576 | regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2576:5: note: candidate expects 5 arguments, 3 provided /usr/include/c++/14/bits/regex.h:2602:5: note: candidate: 'template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, regex_constants::match_flag_type)' 2602 | regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2602:5: note: candidate expects 5 arguments, 3 provided /usr/include/c++/14/bits/regex.h:2628:5: note: candidate: 'template<class _Rx_traits, class _Ch_type, class _St, class _Sa, class _Fst, class _Fsa> std::__cxx11::basic_string<_Ch_type, _St, _Sa> std::regex_replace(const __cxx11::basic_string<_Ch_type, _St, _Sa>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const __cxx11::basic_string<_Ch_type, _Fst, _Fsa>&, regex_constants::match_flag_type)' 2628 | regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2628:5: note: template argument deduction/substitution failed: a.cc:17:36: note: mismatched types 'const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'const char [6]' 17 | tmp = regex_replace(str,"apple", "peach"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2654:5: note: candidate: 'template<class _Rx_traits, class _Ch_type, class _St, class _Sa> std::__cxx11::basic_string<_Ch_type, _St, _Sa> std::regex_replace(const __cxx11::basic_string<_Ch_type, _St, _Sa>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, regex_constants::match_flag_type)' 2654 | regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2654:5: note: template argument deduction/substitution failed: a.cc:17:36: note: mismatched types 'const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'const char [6]' 17 | tmp = regex_replace(str,"apple", "peach"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2680:5: note: candidate: 'template<class _Rx_traits, class _Ch_type, class _St, class _Sa> std::__cxx11::basic_string<_Ch_type> std::regex_replace(const _Ch_type*, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const __cxx11::basic_string<_Ch_type, _St, _Sa>&, regex_constants::match_flag_type)' 2680 | regex_replace(const _Ch_type* __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2680:5: note: template argument deduction/substitution failed: a.cc:17:36: note: mismatched types 'const _Ch_type*' and 'std::__cxx11::basic_string<char>' 17 | tmp = regex_replace(str,"apple", "peach"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2706:5: note: candidate: 'template<class _Rx_traits, class _Ch_type> std::__cxx11::basic_string<_Ch_type> std::regex_replace(const _Ch_type*, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, regex_constants::match_flag_type)' 2706 | regex_replace(const _Ch_type* __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2706:5: note: template argument deduction/substitution failed: a.cc:17:36: note: mismatched types 'const _Ch_type*' and 'std::__cxx11::basic_string<char>' 17 | tmp = regex_replace(str,"apple", "peach"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ a.cc:19:44: error: no matching function for call to 'regex_replace(std::string&, const char [6], const char [6])' 19 | tmp = regex_replace(str, "peach", "apple"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2576:5: note: candidate: 'template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type, class _St, class _Sa> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const __cxx11::basic_string<_Ch_type, _St, _Sa>&, regex_constants::match_flag_type)' 2576 | regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2576:5: note: candidate expects 5 arguments, 3 provided /usr/include/c++/14/bits/regex.h:2602:5: note: candidate: 'template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, regex_constants::match_flag_type)' 2602 | regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2602:5: note: candidate expects 5 arguments, 3 provided /usr/include/c++/14/bits/regex.h:2628:5: note: candidate: 'template<class _Rx_traits, class _Ch_type, class _St, class _Sa, class _Fst, class _Fsa> std::__cxx11::basic_string<_Ch_type, _St, _Sa> std::regex_replace(const __cxx11::basic_string<_Ch_type, _St, _Sa>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const __cxx11::basic_string<_Ch_type, _Fst, _Fsa>&, regex_constants::match_flag_type)' 2628 | regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2628:5: note: template argument deduction/substitution failed: a.cc:19:44: note: mismatched types 'const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'const char [6]' 19 | tmp = regex_replace(str, "peach", "apple"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2654:5: note: candidate: 'template<class _Rx_traits, class _Ch_type, class _St, class _Sa> std::__cxx11::basic_string<_Ch_type, _St, _Sa> std::regex_replace(const __cxx11::basic_string<_Ch_type, _St, _Sa>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, regex_constants::match_flag_type)' 2654 | regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2654:5: note: template argument deduction/substitution failed: a.cc:19:44: note: mismatched types 'const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'const char [6]' 19 | tmp = regex_replace(str, "peach", "apple"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2680:5: note: candidate: 'template<class _Rx_traits, class _Ch_type, class _St, class _Sa> std::__cxx11::basic_string<_Ch_type> std::regex_replace(const _Ch_type*, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const __cxx11::basic_string<_Ch_type, _St, _Sa>&, regex_constants::match_flag_type)' 2680 | regex_replace(const _Ch_type* __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2680:5: note: template argument deduction/substitution failed: a.cc:19:44: note: mismatched types 'const _Ch_type*' and 'std::__cxx11::basic_string<char>' 19 | tmp = regex_replace(str, "peach", "apple"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2706:5: note: candidate: 'template<class _Rx_traits, class _Ch_type> std::__cxx11::basic_string<_Ch_type> std::regex_replace(const _Ch_type*, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, regex_constants::match_flag_type)' 2706 | regex_replace(const _Ch_type* __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2706:5: note: template argument deduction/substitution failed: a.cc:19:44: note: mismatched types 'const _Ch_type*' and 'std::__cxx11::basic_string<char>' 19 | tmp = regex_replace(str, "peach", "apple"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
s304082642
p00050
C++
#include <iostream> #include <string> #include <sstream> #include <regex> using namespace std; int main() { string str; getline(cin, str); stringstream ss(str); while (!ss.eof()) { ss >> str; string tmp = ""; tmp = regex_replace(str,"apple", "peach"); if (str == tmp) { tmp = regex_replace(str, "peach", "apple"); } cout << tmp << (!ss.eof() ? ' ' : '\n'); } return 0; }
a.cc: In function 'int main()': a.cc:17:36: error: no matching function for call to 'regex_replace(std::string&, const char [6], const char [6])' 17 | tmp = regex_replace(str,"apple", "peach"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/regex:68, from a.cc:4: /usr/include/c++/14/bits/regex.h:2576:5: note: candidate: 'template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type, class _St, class _Sa> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const __cxx11::basic_string<_Ch_type, _St, _Sa>&, regex_constants::match_flag_type)' 2576 | regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2576:5: note: candidate expects 5 arguments, 3 provided /usr/include/c++/14/bits/regex.h:2602:5: note: candidate: 'template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, regex_constants::match_flag_type)' 2602 | regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2602:5: note: candidate expects 5 arguments, 3 provided /usr/include/c++/14/bits/regex.h:2628:5: note: candidate: 'template<class _Rx_traits, class _Ch_type, class _St, class _Sa, class _Fst, class _Fsa> std::__cxx11::basic_string<_Ch_type, _St, _Sa> std::regex_replace(const __cxx11::basic_string<_Ch_type, _St, _Sa>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const __cxx11::basic_string<_Ch_type, _Fst, _Fsa>&, regex_constants::match_flag_type)' 2628 | regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2628:5: note: template argument deduction/substitution failed: a.cc:17:36: note: mismatched types 'const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'const char [6]' 17 | tmp = regex_replace(str,"apple", "peach"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2654:5: note: candidate: 'template<class _Rx_traits, class _Ch_type, class _St, class _Sa> std::__cxx11::basic_string<_Ch_type, _St, _Sa> std::regex_replace(const __cxx11::basic_string<_Ch_type, _St, _Sa>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, regex_constants::match_flag_type)' 2654 | regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2654:5: note: template argument deduction/substitution failed: a.cc:17:36: note: mismatched types 'const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'const char [6]' 17 | tmp = regex_replace(str,"apple", "peach"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2680:5: note: candidate: 'template<class _Rx_traits, class _Ch_type, class _St, class _Sa> std::__cxx11::basic_string<_Ch_type> std::regex_replace(const _Ch_type*, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const __cxx11::basic_string<_Ch_type, _St, _Sa>&, regex_constants::match_flag_type)' 2680 | regex_replace(const _Ch_type* __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2680:5: note: template argument deduction/substitution failed: a.cc:17:36: note: mismatched types 'const _Ch_type*' and 'std::__cxx11::basic_string<char>' 17 | tmp = regex_replace(str,"apple", "peach"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2706:5: note: candidate: 'template<class _Rx_traits, class _Ch_type> std::__cxx11::basic_string<_Ch_type> std::regex_replace(const _Ch_type*, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, regex_constants::match_flag_type)' 2706 | regex_replace(const _Ch_type* __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2706:5: note: template argument deduction/substitution failed: a.cc:17:36: note: mismatched types 'const _Ch_type*' and 'std::__cxx11::basic_string<char>' 17 | tmp = regex_replace(str,"apple", "peach"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ a.cc:19:44: error: no matching function for call to 'regex_replace(std::string&, const char [6], const char [6])' 19 | tmp = regex_replace(str, "peach", "apple"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2576:5: note: candidate: 'template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type, class _St, class _Sa> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const __cxx11::basic_string<_Ch_type, _St, _Sa>&, regex_constants::match_flag_type)' 2576 | regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2576:5: note: candidate expects 5 arguments, 3 provided /usr/include/c++/14/bits/regex.h:2602:5: note: candidate: 'template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, regex_constants::match_flag_type)' 2602 | regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2602:5: note: candidate expects 5 arguments, 3 provided /usr/include/c++/14/bits/regex.h:2628:5: note: candidate: 'template<class _Rx_traits, class _Ch_type, class _St, class _Sa, class _Fst, class _Fsa> std::__cxx11::basic_string<_Ch_type, _St, _Sa> std::regex_replace(const __cxx11::basic_string<_Ch_type, _St, _Sa>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const __cxx11::basic_string<_Ch_type, _Fst, _Fsa>&, regex_constants::match_flag_type)' 2628 | regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2628:5: note: template argument deduction/substitution failed: a.cc:19:44: note: mismatched types 'const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'const char [6]' 19 | tmp = regex_replace(str, "peach", "apple"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2654:5: note: candidate: 'template<class _Rx_traits, class _Ch_type, class _St, class _Sa> std::__cxx11::basic_string<_Ch_type, _St, _Sa> std::regex_replace(const __cxx11::basic_string<_Ch_type, _St, _Sa>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, regex_constants::match_flag_type)' 2654 | regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2654:5: note: template argument deduction/substitution failed: a.cc:19:44: note: mismatched types 'const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'const char [6]' 19 | tmp = regex_replace(str, "peach", "apple"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2680:5: note: candidate: 'template<class _Rx_traits, class _Ch_type, class _St, class _Sa> std::__cxx11::basic_string<_Ch_type> std::regex_replace(const _Ch_type*, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const __cxx11::basic_string<_Ch_type, _St, _Sa>&, regex_constants::match_flag_type)' 2680 | regex_replace(const _Ch_type* __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2680:5: note: template argument deduction/substitution failed: a.cc:19:44: note: mismatched types 'const _Ch_type*' and 'std::__cxx11::basic_string<char>' 19 | tmp = regex_replace(str, "peach", "apple"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2706:5: note: candidate: 'template<class _Rx_traits, class _Ch_type> std::__cxx11::basic_string<_Ch_type> std::regex_replace(const _Ch_type*, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, regex_constants::match_flag_type)' 2706 | regex_replace(const _Ch_type* __s, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2706:5: note: template argument deduction/substitution failed: a.cc:19:44: note: mismatched types 'const _Ch_type*' and 'std::__cxx11::basic_string<char>' 19 | tmp = regex_replace(str, "peach", "apple"); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
s590529362
p00050
C++
#include<iostream> #include<string> int main(){ string n; while(cin>>n){ if(n=="peach")cout<<"apple" else if(n=="apple")cout<<"peach"; else cout<<n; if(n[n.size()-1]=='.')cout<<endl; else cout<<" "; } return 0; }
a.cc: In function 'int main()': a.cc:4:1: error: 'string' was not declared in this scope 4 | string n; | ^~~~~~ a.cc:4:1: note: suggested alternatives: In file included from /usr/include/c++/14/iosfwd:41, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string' 77 | typedef basic_string<char> string; | ^~~~~~ In file included 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/string:76:11: note: 'std::pmr::string' 76 | using string = basic_string<char>; | ^~~~~~ a.cc:5:7: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 5 | while(cin>>n){ | ^~~ | std::cin /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:5:12: error: 'n' was not declared in this scope 5 | while(cin>>n){ | ^ a.cc:6:15: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 6 | if(n=="peach")cout<<"apple" | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:8:6: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 8 | else cout<<n; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:9:23: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 9 | if(n[n.size()-1]=='.')cout<<endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:9:29: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 9 | if(n[n.size()-1]=='.')cout<<endl; | ^~~~ | std::endl /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~ a.cc:10:6: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 10 | else cout<<" "; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~
s220358042
p00050
C++
#include<iostream> #include<string> using namespace std; int main(){ string n; while(cin>>n){ if(n=="peach")cout<<"apple" else if(n=="apple")cout<<"peach"; else cout<<n; if(n[n.size()-1]=='.')cout<<endl; else cout<<" "; } return 0; }
a.cc: In function 'int main()': a.cc:7:28: error: expected ';' before 'else' 7 | if(n=="peach")cout<<"apple" | ^ | ; 8 | else if(n=="apple")cout<<"peach"; | ~~~~
s259721947
p00050
C++
#include<iostream> #include<string> #include<vector> #include<cstdio> #include<sstream> #include<algorithm> #include<cmath> #include<map> #include<functional> using namespace std; int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;} string itos(int x){stringstream ss;ss<<x;return ss.str();} int main(){ string n,tmp; getline(cin,n); for(int i=0;i<n.size();i++){ if(n[i]=='a'&&n[i+1]=='p'&&n[i+2]=='p'&&n[i+3]=='l'&&n[i+4]=='e'){ cout<<"peach"; i+=5; } else if(n[i]=='p'&&n[i+1]=='e'&&n[i+2]=='a'&&n[i+3]=='c'&&n[i+4]=='h'){ cout<<"apple"; i+=t; } else cout<<n[i]; } return 0; }
a.cc: In function 'int main()': a.cc:23:12: error: 't' was not declared in this scope 23 | i+=t; | ^
s056099745
p00050
C++
ans = gets.chomp.split(/([' '.])/).map(&:to_s).map{ |s| if s == 'apple' s = 'peach' elsif s == 'peach' s = 'apple' else s = s end }.join('') puts ans
a.cc:2:17: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 2 | if s == 'apple' | ^~~~~~~ a.cc:3:21: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 3 | s = 'peach' | ^~~~~~~ a.cc:4:20: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 4 | elsif s == 'peach' | ^~~~~~~ a.cc:5:21: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 5 | s = 'apple' | ^~~~~~~ a.cc:9:8: error: empty character constant 9 | }.join('') | ^~ a.cc:1:1: error: 'ans' does not name a type 1 | ans = gets.chomp.split(/([' '.])/).map(&:to_s).map{ |s| | ^~~ a.cc:9:2: error: expected unqualified-id before '.' token 9 | }.join('') | ^
s295364890
p00050
C++
str = gets.gsub(/apple/, 'spade') str.gsub!(/peach/, 'apple') str.gsub!(/spade/, 'peach') puts str
a.cc:1:26: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 1 | str = gets.gsub(/apple/, 'spade') | ^~~~~~~ a.cc:2:20: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 2 | str.gsub!(/peach/, 'apple') | ^~~~~~~ a.cc:3:20: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 3 | str.gsub!(/spade/, 'peach') | ^~~~~~~ a.cc:1:1: error: 'str' does not name a type 1 | str = gets.gsub(/apple/, 'spade') | ^~~
s082805801
p00050
C++
#include<stdio.h> #include<iostream> #include<string> using namespace std; int main(){ string st; string app="apple"; string pea="peach"; string t; bool f=false; while(cin>>st){ if(st.size()>=5) { if(f==true)cout<<" "; for(int i=0;i<5;i++) t[i]=st[i]; if(t=="apple"){ for(int i=0;i<5;i++) st[i]=pea[i]; } cout<<st; f=truel; } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:26:3: error: 'truel' was not declared in this scope 26 | f=truel; | ^~~~~ a.cc:30:2: error: expected '}' at end of input 30 | } | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^
s101866899
p00050
C++
#include<stdio.h> int main(){ char cx[1024]; char px[10]="peach",ax[10]="apple"; char y[6]; while(scanf("%s",cx)!=EOF){ for(int i=0;i<5;i++){ y[i]=cx[i]; } if(y[0]=='p'&&y[1]=='e'&&y[2]=='a'&&y[3]=='c'&&y[4]=='h'){ for(int i=0;i<5;i++) cx[i]=ax[i]; else if(y[0]=='a'&&y[1]=='p'&&y[2]=='p'&&y[3]=='l'&&y[4]=='e'){ for(int i=0;i<5;i++) cx[i]=px[i]; printf("%s",cx); } return 0; }
a.cc: In function 'int main()': a.cc:19:1: error: expected '}' before 'else' 19 | else if(y[0]=='a'&&y[1]=='p'&&y[2]=='p'&&y[3]=='l'&&y[4]=='e'){ | ^~~~ a.cc:15:58: note: to match this '{' 15 | if(y[0]=='p'&&y[1]=='e'&&y[2]=='a'&&y[3]=='c'&&y[4]=='h'){ | ^ a.cc:26:2: error: expected '}' at end of input 26 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s516150752
p00050
C++
#include <cstdio> using namespace std; int main(){ char str[1000]; char app[5] = "apple", pea[5] = "peach"; bool output, first; first = true; while((scanf("%s", str)) != EOF){ output = false; if(!first) printf(" "); first = false; for(int i = 0; i < 5; i++){ if(app[i] != str[i]) break; if(i + 1 == 5 && (str[5] == 0 || str[5] == '.')){ printf("%s", pea); if(str[5] == '.') printf("."); output = true; } } if(!output){ for(int i = 0; i < 5; i++){ if(pea[i] != str[i]) break; if(i + 1 == 5 && (str[5] == 0 || str[5] == '.')){ printf("%s", app); if(str[5] == '.') printf("."); output = true; } } } if(!output){ printf("%s", str); } } printf("\n"); return 0; }
a.cc: In function 'int main()': a.cc:6:23: error: initializer-string for 'char [5]' is too long [-fpermissive] 6 | char app[5] = "apple", pea[5] = "peach"; | ^~~~~~~ a.cc:6:41: error: initializer-string for 'char [5]' is too long [-fpermissive] 6 | char app[5] = "apple", pea[5] = "peach"; | ^~~~~~~
s286517136
p00050
C++
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner input=new Scanner(System.in); String str; String res=""; while(input.hasNext()){ str=input.next(); for(int i=0;i<str.length()-4;i++){ if((str.substring(i,i+5)).equals("apple")) str=str.replaceAll("apple","peach"); else if((str.substring(i,i+5)).equals("peach")) str=str.replaceAll("peach","apple"); } res=res.concat(str+" "); } System.out.println(res.trim()); input.close(); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main{ | ^~~~~~
s360064087
p00050
C++
#include<iostream> #include<strring> using namespace std; int main() { string s; getline(cin, s); string::size_type pos1,pos2, begin; while(1){ pos1 = s.find("apple", begin); pos2 = s.find("peach", begin); if( pos1 == string::npos && pos2 == string::npos ) break; if( pos1 < pos2 ){ s.replace( pos1, 5, "peach" ); i = pos1 + 5; }else{ s.replace( pos2, 5, "apple" ); i = pos2 + 5; } } cout << s << endl; }
a.cc:2:9: fatal error: strring: No such file or directory 2 | #include<strring> | ^~~~~~~~~ compilation terminated.
s581318533
p00050
C++
#include<iostream> #include<string> using namespace std; int main() { string s; getline(cin, s); string::size_type pos1,pos2, begin; while(1){ pos1 = s.find("apple", begin); pos2 = s.find("peach", begin); if( pos1 == string::npos && pos2 == string::npos ) break; if( pos1 < pos2 ){ s.replace( pos1, 5, "peach" ); i = pos1 + 5; }else{ s.replace( pos2, 5, "apple" ); i = pos2 + 5; } } cout << s << endl; }
a.cc: In function 'int main()': a.cc:19:25: error: 'i' was not declared in this scope 19 | i = pos1 + 5; | ^ a.cc:22:25: error: 'i' was not declared in this scope 22 | i = pos2 + 5; | ^
s333768050
p00050
C++
#include <cstdio> #include <cstring> #include <stack> using namespace std; char ary[1010]; int main(){ gets(ary); int n=strlen(ary); stack<int> pe,ap; for(int i=0;i<n-4;i++){ if(ary[i]=='a'&&ary[i+1]=='p'&&ary[i+2]=='p'&&ary[i+3]=='l'&&ary[i+4]=='e') ap.push(i); else if(ary[i]=='p'&&ary[i+1]=='e'&&ary[i+2]=='a'&&ary[i+3]=='c'&&ary[i+4]=='h') pe.push(i); } while(!ap.empty()){ int tmp=ap.top();ap.pop(); ary[tmp]='p'; ary[tmp+1]='e'; ary[tmp+2]='a'; ary[tmp+3]='c'; ary[tmp+4]='h'; } while(!pe.empty()){ int tmp=pe.top();pe.pop(); ary[tmp]='a'; ary[tmp+1]='p'; ary[tmp+2]='p'; ary[tmp+3]='l'; ary[tmp+4]='e'; } printf("%s\n",ary); 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(ary); | ^~~~ | getw
s671541151
p00050
C++
#include<stdio.h> #include<string.h> int main() { int c; char str[1024]; gets(str); for(c=0;c<strlen(str);c++){ if(strncmp(&str[c],"apple",5)==0){ str[c]='p'; str[c+1]='e'; str[c+2]='a'; str[c+3]='c'; str[c+4]='h'; }else if(strncmp(&str[c],"peach",5)==0){ str[c]='a'; str[c+1]='p'; str[c+2]='p'; str[c+3]='l'; str[c+4]='e'; } } printf("%s\n",str); 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(str); | ^~~~ | getw
s563381360
p00050
C++
#include <stdio.h> int main(){ char c[1000],now=0; for(int i=0;i<1000;i++)c[i]='\0'; while(scanf("%c",&c[now])!=EOF)now++; for(int i=0;c[i]!='\0';i++){ if(c[i]=='p'&&c[i+1]=='e'&&c[i+2]=='a'&&c[i+3]=='c'&&c[i+4]=='h'){ c[i]=a; c[i+1]=p; c[i+2]=p; c[i+3]=l; c[i+4]=e; } if(c[i]=='a'&&c[i+1]=='p'&&c[i+2]=='p'&&c[i+3]=='l'&&c[i+4]=='e'){ c[i]=p; c[i+1]=e; c[i+2]=a; c[i+3]=c; c[i+4]=h; } printf("%c",c[i]); } printf("\n"); }
a.cc: In function 'int main()': a.cc:9:6: error: 'a' was not declared in this scope 9 | c[i]=a; | ^ a.cc:10:8: error: 'p' was not declared in this scope 10 | c[i+1]=p; | ^ a.cc:12:8: error: 'l' was not declared in this scope 12 | c[i+3]=l; | ^ a.cc:13:8: error: 'e' was not declared in this scope 13 | c[i+4]=e; | ^ a.cc:16:6: error: 'p' was not declared in this scope 16 | c[i]=p; | ^ a.cc:17:8: error: 'e' was not declared in this scope 17 | c[i+1]=e; | ^ a.cc:18:8: error: 'a' was not declared in this scope 18 | c[i+2]=a; | ^ a.cc:19:8: error: invalid conversion from 'char*' to 'char' [-fpermissive] 19 | c[i+3]=c; | ^ | | | char* a.cc:20:8: error: 'h' was not declared in this scope 20 | c[i+4]=h; | ^
s117285754
p00050
C++
#include <stdio.h> int main(){ char c[1000]; int now=0; for(int i=0;i<1000;i++)c[i]='\0'; while(scanf("%c",&c[now])!=EOF)now++; for(int i=0;c[i]!='\0';i++){ if(c[i]=='p'&&c[i+1]=='e'&&c[i+2]=='a'&&c[i+3]=='c'&&c[i+4]=='h'){ c[i]=a; c[i+1]=p; c[i+2]=p; c[i+3]=l; c[i+4]=e; } if(c[i]=='a'&&c[i+1]=='p'&&c[i+2]=='p'&&c[i+3]=='l'&&c[i+4]=='e'){ c[i]=p; c[i+1]=e; c[i+2]=a; c[i+3]=c; c[i+4]=h; } printf("%c",c[i]); } printf("\n"); }
a.cc: In function 'int main()': a.cc:10:6: error: 'a' was not declared in this scope 10 | c[i]=a; | ^ a.cc:11:8: error: 'p' was not declared in this scope 11 | c[i+1]=p; | ^ a.cc:13:8: error: 'l' was not declared in this scope 13 | c[i+3]=l; | ^ a.cc:14:8: error: 'e' was not declared in this scope 14 | c[i+4]=e; | ^ a.cc:17:6: error: 'p' was not declared in this scope 17 | c[i]=p; | ^ a.cc:18:8: error: 'e' was not declared in this scope 18 | c[i+1]=e; | ^ a.cc:19:8: error: 'a' was not declared in this scope 19 | c[i+2]=a; | ^ a.cc:20:8: error: invalid conversion from 'char*' to 'char' [-fpermissive] 20 | c[i+3]=c; | ^ | | | char* a.cc:21:8: error: 'h' was not declared in this scope 21 | c[i+4]=h; | ^
s193301718
p00050
C++
#include<stdio.h> #include <string.h> int main(void){ char str[1000]; int i,l; fgets(str,1000,stdin); l=strlen(str); for(i=0;i<l;i++){ if(str[i]=='p' && str[i+1]=='e'&&str[i+2]=='a'&&str[i+3]=='c'&&str[i+4]=='h'){ str[i]='a'; str[i+1]='p'; str[i+2]='p'; str[i+3]='l'; str[i+4]='e'; i=i+4; }else if(str[i]=='a' && str[i+1]=='p'&&str[i+2]=='p'&&str[i+3]=='l'&&str[i+4]=='e'){ str[i]='p'; str[i+1]='e'; str[i+2]='a'; str[i+3]='c'; str[i+4]='h'; ??????i=i+4; } } printf("%s",str); return 0; }
a.cc: In function 'int main()': a.cc:23:2: error: expected primary-expression before '?' token 23 | ??????i=i+4; | ^ a.cc:23:3: error: expected primary-expression before '?' token 23 | ??????i=i+4; | ^ a.cc:23:4: error: expected primary-expression before '?' token 23 | ??????i=i+4; | ^ a.cc:23:5: error: expected primary-expression before '?' token 23 | ??????i=i+4; | ^ a.cc:23:6: error: expected primary-expression before '?' token 23 | ??????i=i+4; | ^ a.cc:23:7: error: expected primary-expression before '?' token 23 | ??????i=i+4; | ^ a.cc:23:13: error: expected ':' before ';' token 23 | ??????i=i+4; | ^ | : a.cc:23:13: error: expected primary-expression before ';' token a.cc:23:13: error: expected ':' before ';' token 23 | ??????i=i+4; | ^ | : a.cc:23:13: error: expected primary-expression before ';' token a.cc:23:13: error: expected ':' before ';' token 23 | ??????i=i+4; | ^ | : a.cc:23:13: error: expected primary-expression before ';' token a.cc:23:13: error: expected ':' before ';' token 23 | ??????i=i+4; | ^ | : a.cc:23:13: error: expected primary-expression before ';' token a.cc:23:13: error: expected ':' before ';' token 23 | ??????i=i+4; | ^ | : a.cc:23:13: error: expected primary-expression before ';' token a.cc:23:13: error: expected ':' before ';' token 23 | ??????i=i+4; | ^ | : a.cc:23:13: error: expected primary-expression before ';' token
s354219220
p00050
C++
#include<iostream> #include<string> using namespace std; int main() { int n = 0; string a[1000]; while(cin >> a[n]){ if(a[n] == "apple"){ a[n] = "peach"; }else if (a[n] == "peach"){ a[n] = "apple"; }else if(a[n] == "apple."){ a[n] = "peach."; }else if (a[n] == "peach."){ a[n] = "apple."; } n++; } for(int i=0; i<n-2; i++){ cout << a[i] <<" "; } cout << a[i-1] <<endl; return 0; }
a.cc: In function 'int main()': a.cc:23:13: error: 'i' was not declared in this scope 23 | cout << a[i-1] <<endl; | ^
s527036263
p00050
C++
#include<iostream> #include<string> using namespace std; int main() { int n = 0; string a[1000]; while(cin >> a[n]){ if(a[n] == "apple"){ a[n] = "peach"; }else if (a[n] == "peach"){ a[n] = "apple"; }else if(a[n] == "apple."){ a[n] = "peach."; }else if (a[n] == "peach."){ a[n] = "apple."; } n++; } for(int i=0; i<n-2; i++){ cout << a[i] <<" "; } cout << a[i-1] <<endl; return 0; }
a.cc: In function 'int main()': a.cc:23:13: error: 'i' was not declared in this scope 23 | cout << a[i-1] <<endl; | ^
s719913688
p00050
C++
#include <cstdio> #include <cstring> using namespace std; int main(void){ char buf[1024],*p; gets(buf); while(p=strstr(buf,"apple")){ strncpy(p,"*****", 5); } while(p=strstr(buf,"peach")){ strncpy(p,"apple",5); } while(p=strstr(buf,"*****")){ strncpy(p,"peach",5); } puts(buf); return 0; }
a.cc: In function 'int main()': a.cc:9:3: error: 'gets' was not declared in this scope; did you mean 'getw'? 9 | gets(buf); | ^~~~ | getw
s473377441
p00050
C++
#include <cstdio> #include <cstring> using namespace std; int main(void){ char buf[1024],*p; fgets(buf, 1024, stdin); while(p=strstr(buf,"apple")){ strncpy(p,"*****", 5); } while(p=strstr(buf,"peach")){ strncpy(p,"apple",5); } while(p=strstr(buf,"*****")){ strncpy(p,"peach",5); } strrchr(buf,10)=0; puts(buf); return 0; }
a.cc: In function 'int main()': a.cc:19:10: error: lvalue required as left operand of assignment 19 | strrchr(buf,10)=0; | ~~~~~~~^~~~~~~~
s168169809
p00050
C++
#include<iostream> #include<string> #include<vector> using namespace std; int main() { int n = 0; vector<string> a(1000); while(cin >> a){ if(a[n] == "apple"){ a[n] = "peach"; }else if (a[n] == "peach"){ a[n] = "apple"; }else if(a[n] == "apple."){ a[n] = "peach."; }else if (a[n] == "peach."){ a[n] = "apple."; } n++; } for(int i=0; i<n-1; i++){ cout << a[i] <<" "; } cout << a[n-1] <<endl; return 0; }
a.cc: In function 'int main()': a.cc:9:13: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<std::__cxx11::basic_string<char> >') 9 | while(cin >> a){ | ~~~ ^~ ~ | | | | | std::vector<std::__cxx11::basic_string<char> > | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/inclu
s103092603
p00050
C++
#include<iostream> #include<string> #include<vector> using namespace std; int main() { int n = 0; vector<string> a(1000); while(cin >> a){ if(a[n] == "apple"){ a[n] = "peach"; }else if (a[n] == "peach"){ a[n] = "apple"; }else if(a[n] == "apple."){ a[n] = "peach."; }else if (a[n] == "peach."){ a[n] = "apple."; } n++; } for(int i=0; i<n-1; i++){ cout << a[i] <<" "; } cout << a[n-1] <<endl; return 0; }
a.cc: In function 'int main()': a.cc:9:13: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<std::__cxx11::basic_string<char> >') 9 | while(cin >> a){ | ~~~ ^~ ~ | | | | | std::vector<std::__cxx11::basic_string<char> > | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/inclu
s539936808
p00050
C++
#include<stdio.h> #include<string.h> int main(){ char ss[2000],out[2000],temp[2000]; int i,j,k; while(NULL!=gets(ss)){ j=0; for(i=0;i<1800;i++){ if(ss[i]=='a' && ss[i+1]=='p' && ss[i+2]=='p' && ss[i+3]=='l' && ss[i+4]=='e'){ out[j]='p'; out[j+1]='e'; out[j+2]='a'; out[j+3]='c'; out[j+4]='h'; out[j+5]='@'; j+=6; i+=4; continue; } out[j]=ss[i]; ++j; } j=0; for(i=0;i<1800;i++){ if(out[i]=='p' && out[i+1]=='e' && out[i+2]=='a' && out[i+3]=='c' && out[i+4]=='h' && out[i+5]!='@'){ ss[j]='a'; ss[j+1]='p'; ss[j+2]='p'; ss[j+3]='l'; ss[j+4]='e'; j+=5; i+=4; continue; } ss[j]=out[i]; ++j; } j=0; while(0!=ss[j]){ if(ss[j]=='@'){ ++j; continue; } printf("%c",ss[j]); ++j; } printf("\n"); } return 0; }
a.cc: In function 'int main()': a.cc:8:21: error: 'gets' was not declared in this scope; did you mean 'getw'? 8 | while(NULL!=gets(ss)){ | ^~~~ | getw
s434331559
p00050
C++
#include<iostream> #include<algorithm> #include<vector> #include<stack> #include<queue> #include<cstdio> #include<climits> #include<cmath> #include<cstring> #include<string> #define f first #define s second #define mp make_pair #define REP(i,n) for(int i=0; i<(int)(n); i++) #define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++) #define ALL(c) (c).begin(), (c).end() using namespace std; typedef unsigned int uint; typedef long long ll; int main(){ char buff[2000]; while(gets(buff)){ int len = strlen(buff); REP(i,len-5) if(strncmp(buff+i, "apple", 5) == 0) strncpy(buff+i, "peach", 5); else if(strncmp(buff+i, "peach", 5) == 0) strncpy(buff+i, "apple", 5); puts(buff); } return 0; }
a.cc: In function 'int main()': a.cc:27:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 27 | while(gets(buff)){ | ^~~~ | getw
s665016681
p00050
C++
#include <iostream> #include <string> #include <map> #include <vector> #include <algorithm> #include <stdio.h> #include <math.h> #include <iomanip> using namespace std; int main(){ string s,a="apple",p="peach"; vector<string> v; while(cin>>s){ if(s.size()>=5){ if(!(a.compare(s.substr(0,5))))s="peach"; if(!(p.compare(s.substr(0,5))))s="apple"; } v.push_back(s); if(s[s.size()-1]=="."{ vector<string>::iterator it = v.begin(); while(it!=v.end()){ cout<<*it; (it+1==v.end())?cout<<endl:cout<<" "; it++; } return 0} } } }
a.cc: In function 'int main()': a.cc:19:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 19 | if(s[s.size()-1]=="."{ a.cc:19:26: error: expected ')' before '{' token 19 | if(s[s.size()-1]=="."{ | ~ ^ | ) a.cc:27:3: error: expected primary-expression before '}' token 27 | } | ^ a.cc: At global scope: a.cc:30:1: error: expected declaration before '}' token 30 | } | ^
s164471425
p00050
C++
#include <iostream> #include <string> #include <map> #include <vector> #include <algorithm> #include <stdio.h> #include <math.h> #include <iomanip> using namespace std; int main(){ string s,a="apple",p="peach"; vector<string> v; while(cin>>s){ if(s.size()>=5){ if(!(a.compare(s.substr(0,5))))s="peach"; if(!(p.compare(s.substr(0,5))))s="apple"; } v.push_back(s); if(s[s.size()-1]=='.'){ vector<string>::iterator it = v.begin(); while(it!=v.end()){ cout<<*it; (it+1==v.end())?cout<<endl:cout<<" "; it++; } return 0} } } }
a.cc: In function 'int main()': a.cc:26:13: error: expected ';' before '}' token 26 | return 0} | ^ | ; a.cc: At global scope: a.cc:30:1: error: expected declaration before '}' token 30 | } | ^
s429228647
p00050
C++
import java.util.*; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); ArrayList<String> al = new ArrayList<String>(); while(sc.hasNext()) { String s = sc.next(); if(s.contains("apple")) { al.add(s.replace("apple", "peach")); } else if(s.contains("peach")) { al.add(s.replace("peach", "apple")); } else { al.add(s); } } System.out.print(al.get(0)); for(int i = 1, n = al.size(); i < n; i++) { System.out.print(" " + al.get(i)); } System.out.println(); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s853407944
p00050
C++
#include<iostream> #include<string> #include<vector> using namespace std; vector<string> split(string&); void StringHandle(string&); bool space(char); bool not_space(char); int main(){ string str; vector<string> Str; getline(cin, str); Str = split(str); for(string::size_type i=0; i<Str.size(); ++i){ if(Str[i] == "apple") Str[i] = "peach"; else if(Str[i] == "peach") Str[i] = "apple"; } for(string::size_type i=0; i<Str.size()-2; ++i) cout << Str[i] << " "; cout << Str[Str.size()-2] << "." << endl; return 0; } vector<string> split(string& str){ string _str; vector<string> Str; string::iterator i, j; j = str.begin(); while(i < str.end() || j < str.end()){ i = find_if(j, str.end(), not_space); j = find_if(i, str.end(), space); copy(i, j, back_inserter(_str)); StringHandle(_str); Str.push_back(_str); _str.clear(); } return Str; } void StringHandle(string& s){ if(s[s.size()-1] < 'a' || s[s.size()-1] > 'z') s = s.substr(0, s.size()-1); } bool space(char c){ return (isspace(c)); } bool not_space(char c){ return (!isspace(c)); }
a.cc: In function 'std::vector<std::__cxx11::basic_string<char> > split(std::string&)': a.cc:40:9: error: 'find_if' was not declared in this scope 40 | i = find_if(j, str.end(), not_space); | ^~~~~~~
s061414726
p00050
C++
#include <stdio.h> #include <string.h> int main(void){ char s[1001]; char* p; char* a; gets(s); p = strstr(s, "peach"); a = strstr(s, "apple"); while(1){ if(p == NULL && a == NULL) break; if(a == NULL || p < a && p != NULL){ p[0] = 'a'; p[1] = 'p'; p[2] = 'p'; p[3] = 'l'; p[4] = 'e'; p = strstr(p, "peach"); }else if(p == NULL || a < p && a != NULL){ a[0] = 'p'; a[1] = 'e'; a[2] = 'a'; a[3] = 'c'; a[4] = 'h'; a = strstr(a, "apple"); } } printf("%s\n", s); 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
s727092058
p00050
C++
#include<cstdio> int main() { char map[2][6]={"apple","peach"}; char c[1005]={0}; gets(c); for(int i=0;i<1000;i++) { if(c[i]=='\0')break; int a=0,p=0; for(int j=0;j<5;j++) { if(map[0][j]==c[i+j])a++; if(map[1][j]==c[j+i])p++; } if(a==5) { printf("peach"); i+=4; } if(p==5) { printf("apple"); i+=4; } else printf("%c",c[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(c); | ^~~~ | getw
s856165437
p00050
C++
#include<cstdio> int main() { char map[2][6]={"apple","peach"}; char c[1005]={0}; gets(c); for(int i=0;i<1000;i++) { if(c[i]=='\0')break; int a=0,p=0; for(int j=0;j<5;j++) { if(map[0][j]==c[i+j])a++; if(map[1][j]==c[j+i])p++; } if(a==5) { printf("peach"); i+=4; } if(p==5) { printf("apple"); i+=4; } else printf("%c",c[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(c); | ^~~~ | getw
s719951640
p00050
C++
#include<cstdio> int main() { char map[2][6]={"apple","peach"}; char c[10000]={0}; gets(c); for(int i=0;i<1000;i++) { if(c[i]=='\0')break; int a=0,p=0; for(int j=0;j<5;j++) { if(map[0][j]==c[i+j])a++; if(map[1][j]==c[j+i])p++; } if(a==5) { printf("peach"); i+=4; } if(p==5) { printf("apple"); i+=4; } else printf("%c",c[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(c); | ^~~~ | getw
s024278351
p00050
C++
import java.io.*; import java.util.regex.Pattern; import java.util.regex.Matcher; public class aoj0050 { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s,ans; s = br.readLine(); Matcher m = Pattern.compile("apple").matcher(s); s = m.replaceAll("tmp"); Matcher ms = Pattern.compile("peach").matcher(s); s = ms.replaceAll("apple"); Matcher mf = Pattern.compile("tmp").matcher(s); s = mf.replaceAll("peach"); System.out.println(s); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.util.regex.Pattern; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.util.regex.Matcher; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: expected unqualified-id before 'public' 4 | public class aoj0050 { | ^~~~~~
s419125365
p00050
C++
using System; namespace _0050 { class Program { static void Main(string[] args) { var modifyTexts = Console.ReadLine().Replace("apple", "apple_").Replace("peach", "apple").Replace("apple_", "peach"); Console.WriteLine(modifyTexts); } } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:7:26: error: 'string' has not been declared 7 | static void Main(string[] args) | ^~~~~~ a.cc:7:35: error: expected ',' or '...' before 'args' 7 | static void Main(string[] args) | ^~~~ a.cc:12:6: error: expected ';' after class definition 12 | } | ^ | ; a.cc: In static member function 'static void _0050::Program::Main(int*)': a.cc:9:13: error: 'var' was not declared in this scope 9 | var modifyTexts = Console.ReadLine().Replace("apple", "apple_").Replace("peach", "apple").Replace("apple_", "peach"); | ^~~ a.cc:10:13: error: 'Console' was not declared in this scope 10 | Console.WriteLine(modifyTexts); | ^~~~~~~ a.cc:10:31: error: 'modifyTexts' was not declared in this scope 10 | Console.WriteLine(modifyTexts); | ^~~~~~~~~~~
s196113882
p00050
C++
using System; namespace _0050 { class Program { static void Main(string[] args) { var modifyTexts = Console.ReadLine().Replace("apple", "apple_").Replace("peach", "apple").Replace("apple_", "peach"); Console.WriteLine(modifyTexts); } } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:7:26: error: 'string' has not been declared 7 | static void Main(string[] args) | ^~~~~~ a.cc:7:35: error: expected ',' or '...' before 'args' 7 | static void Main(string[] args) | ^~~~ a.cc:12:6: error: expected ';' after class definition 12 | } | ^ | ; a.cc: In static member function 'static void _0050::Program::Main(int*)': a.cc:9:13: error: 'var' was not declared in this scope 9 | var modifyTexts = Console.ReadLine().Replace("apple", "apple_").Replace("peach", "apple").Replace("apple_", "peach"); | ^~~ a.cc:10:13: error: 'Console' was not declared in this scope 10 | Console.WriteLine(modifyTexts); | ^~~~~~~ a.cc:10:31: error: 'modifyTexts' was not declared in this scope 10 | Console.WriteLine(modifyTexts); | ^~~~~~~~~~~
s710664092
p00050
C++
using System; namespace _0050 { class Program { static void Main(string[] args) { string modifyTexts = Console.ReadLine().Replace("apple", "apple_").Replace("peach", "apple").Replace("apple_", "peach"); Console.WriteLine(modifyTexts); } } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:7:26: error: 'string' has not been declared 7 | static void Main(string[] args) | ^~~~~~ a.cc:7:35: error: expected ',' or '...' before 'args' 7 | static void Main(string[] args) | ^~~~ a.cc:12:6: error: expected ';' after class definition 12 | } | ^ | ; a.cc: In static member function 'static void _0050::Program::Main(int*)': a.cc:9:13: error: 'string' was not declared in this scope 9 | string modifyTexts = Console.ReadLine().Replace("apple", "apple_").Replace("peach", "apple").Replace("apple_", "peach"); | ^~~~~~ a.cc:10:13: error: 'Console' was not declared in this scope 10 | Console.WriteLine(modifyTexts); | ^~~~~~~ a.cc:10:31: error: 'modifyTexts' was not declared in this scope 10 | Console.WriteLine(modifyTexts); | ^~~~~~~~~~~
s568758337
p00051
Java
import java.io.*; import java.util.Arrays; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; int maxValue; int minValue; int dif; int[] num=new int[8]; int n=Integer.parseInt(br.readLine()); for(int p=0;p<n;p++){ line=br.readLine(); maxValue=0; minValue=0; dif=0; for(int i=0;i<num.length;i++){ num[i]=(int)(line.charAt(i)-'0'); } Arrays.sort(num); for(int i=0;i<num.length;i++){ maxValue+=num[i]*Math.pow(i); minValue+=num[i]*Math.pow(7-i); } dif=maxValue-minValue; System.out.println(dif) } } }
Main.java:27: error: ';' expected System.out.println(dif) ^ 1 error
s860879222
p00051
Java
import java.io.*; import java.util.Arrays; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; int maxValue; int minValue; int dif; int[] num=new int[8]; int n=Integer.parseInt(br.readLine()); for(int p=0;p<n;p++){ line=br.readLine(); maxValue=0; minValue=0; dif=0; for(int i=0;i<num.length;i++){ num[i]=(int)(line.charAt(i)-'0'); } Arrays.sort(num); for(int i=0;i<num.length;i++){ maxValue+=num[i]*Math.pow(i); minValue+=num[i]*Math.pow(7-i); } dif=maxValue-minValue; System.out.println(dif); } } }
Main.java:23: error: method pow in class Math cannot be applied to given types; maxValue+=num[i]*Math.pow(i); ^ required: double,double found: int reason: actual and formal argument lists differ in length Main.java:24: error: method pow in class Math cannot be applied to given types; minValue+=num[i]*Math.pow(7-i); ^ required: double,double found: int reason: actual and formal argument lists differ in length 2 errors
s943698493
p00051
Java
import java.io.*; class Main { public static void main(String args[])throws IOException { BufferedReader input=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(input.readLine()); for(int i=0;i<n;i++) { String str=input.readLine(); String str_ary[]=new String[8]; int a[]=new int[8]; int b[]=new int[8]; for(int j=0;j<8;j++) { a[j]=Integer.parseInt(str.charAt(j)+""); b[j]=Integer.parseInt(str.charAt(j)+""); } for(int j=0;j<8;j++) { int max=a[j],x=j; for(int k=j;k<8;k++) { if(max<a[k]) { max=a[k]; x=k; } } int tmp=a[j]; a[j]=max; a[x]=tmp; } for(int j=0;j<8;j++) { int mini=b[j],x=j; for(int k=j;k<8;k++) { if(mini>b[k]) { mini=b[k]; x=k; } } int tmp=b[j]; b[j]=mini; b[x]=tmp; } String stra=""; for(int l=0;l<8;l++) { stra+=Integer.toString(a[l]); } int max=Integer.parseInt(stra); String strb=""; for(int l=0;l<8;l++) { if(b[l]==0) else if(b[l]!=0)strb+=Integer.toString(b[l]); } int mini=Integer.parseInt(strb); System.out.println(max-mini); } } }
Main.java:68: error: 'else' without 'if' else if(b[l]!=0)strb+=Integer.toString(b[l]); ^ 1 error
s243033401
p00051
Java
import java.util.Arrays; import java.util.Scanner; public class Test { public static void main(String[] args){ Scanner scan = null; try{ scan = new Scanner(System.in); int n = scan.nextInt(); for(int i = 0 ; i < n;i++){ char[] data = scan.next().toCharArray(); int[] num = new int[data.length]; for(int j = 0 ; j < data.length;j++){ num[j] = Integer.parseInt(String.valueOf(data[j])); } Arrays.sort(num); int ans = 0; for(int j = 0 ;j < num.length;j++){ ans += num[j] * Math.pow(10, j); ans -= num[j] * Math.pow(10, 7 -j); } System.out.println(ans); } }finally{ if(scan !=null)scan.close(); } } }
Main.java:5: error: class Test is public, should be declared in a file named Test.java public class Test { ^ 1 error
s249937424
p00051
C
#include <stdio.h> #include <algorithm> using namespace std; int main(void) { char num[9]; int array[8]; int n; int i; int j; int array2[8]; int max = 0; int min = 0; scanf("%d", &n); for (i = 0; i < n; i++){ scanf("%s", num); for (j = 0; j < 8; j++){ array[j] = num[j] - '0'; } sort(array, array + 8); for (j = 0; j < 8; j++){ array2[j] = array[j]; } reverse(array, array + 8); for (j = 0; j < 8; j++){ max = max * 10 + array[j]; min = min * 10 + array2[j]; } max -= min; printf("%d\n", max); } return 0; }
main.c:2:10: fatal error: algorithm: No such file or directory 2 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s902975716
p00051
C
#include <stdio.h> #include <algorithm> using namespace std; int main(void) { char num[9]; int array[8]; int n; int i; int j; int array2[8]; int num_max; int num_min; scanf("%d", &n); for (i = 0; i < n; i++){ num_max = 0; num_min = 0; scanf("%s", num); for (j = 0; j < 8; j++){ array[j] = num[j] - '0'; } sort(array, array + 8); for (j = 0; j < 8; j++){ array2[j] = array[j]; } reverse(array, array + 8); for (j = 0; j < 8; j++){ num_max = num_max * 10 + array[j]; num_min = num_min * 10 + array2[j]; } num_max -= num_min; printf("%d\n", num_max); } return 0; }
main.c:2:10: fatal error: algorithm: No such file or directory 2 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s736432070
p00051
C
#include<stdio.h> int main(void) { int i.j,n,max,min,t,ii,k; int num[8]; int tem[8]; scanf("%d",&n); for(k=0;k<n;k++){ max=0; min=0; ii=1; for(i=0;i<8;i++){ scanf("%d",&num[i]); tem[i]=num[i]; } for(i=0;i<8;i++){ for(j=i;j<7;j++){ if(tem[j]>tem[j+1]){ t=tem[j]; tem[j]=tem[j+1]; tem[j+1]=t; if(num[j]<num[j+1]){ t=num[j]; num[j]=num[j+1]; num[j+1]=t; } } for(i=0;i<8;i++){ max+=tem[i]*ii; min+=num[i]*ii; ii*=10; } printf("%d\n",max-min); } return 0; }
main.c: In function 'main': main.c:5:6: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 5 | int i.j,n,max,min,t,ii,k; | ^ main.c:5:6: error: expected expression before '.' token main.c:5:9: error: 'n' undeclared (first use in this function) 5 | int i.j,n,max,min,t,ii,k; | ^ main.c:5:9: note: each undeclared identifier is reported only once for each function it appears in main.c:5:11: error: 'max' undeclared (first use in this function) 5 | int i.j,n,max,min,t,ii,k; | ^~~ main.c:5:15: error: 'min' undeclared (first use in this function); did you mean 'main'? 5 | int i.j,n,max,min,t,ii,k; | ^~~ | main main.c:5:19: error: 't' undeclared (first use in this function) 5 | int i.j,n,max,min,t,ii,k; | ^ main.c:5:21: error: 'ii' undeclared (first use in this function) 5 | int i.j,n,max,min,t,ii,k; | ^~ main.c:5:24: error: 'k' undeclared (first use in this function) 5 | int i.j,n,max,min,t,ii,k; | ^ main.c:16:5: error: 'i' undeclared (first use in this function) 16 | for(i=0;i<8;i++){ | ^ main.c:21:5: error: 'j' undeclared (first use in this function) 21 | for(j=i;j<7;j++){ | ^ main.c:44:1: error: expected declaration or statement at end of input 44 | } | ^ main.c:44:1: error: expected declaration or statement at end of input
s915275740
p00051
C
#include<stdio.h> int main(void) { int i,j,n,max,min,t,ii,k; int num[8]; int tem[8]; scanf("%d",&n); for(k=0;k<n;k++){ max=0; min=0; ii=1; for(i=0;i<8;i++){ scanf("%d",&num[i]); tem[i]=num[i]; } for(i=0;i<8;i++){ for(j=i;j<7;j++){ if(tem[j]>tem[j+1]){ t=tem[j]; tem[j]=tem[j+1]; tem[j+1]=t; if(num[j]<num[j+1]){ t=num[j]; num[j]=num[j+1]; num[j+1]=t; } } for(i=0;i<8;i++){ max+=tem[i]*ii; min+=num[i]*ii; ii*=10; } printf("%d\n",max-min); } return 0; }
main.c: In function 'main': main.c:44:1: error: expected declaration or statement at end of input 44 | } | ^ main.c:44:1: error: expected declaration or statement at end of input
s574477920
p00051
C
include <stdio.h> #include <stdlib.h> #define N 8 int main(void){ int i, j, k, n, max, min; char tmp, num[N+1]; scanf("%d", &n); for(i = 0; i < n; i++){ scanf("%s", num); for(j = N-1; j > 0; j--){ for(k = 0; k < j; k++){ if(num[k] > num[k+1]){ tmp = num[k]; num[k] = num[k+1]; num[k+1] = tmp; } } } min = atoi(num); for(j = 0; j < N/2; j++){ tmp = num[j]; num[j] = num[N-1-j]; num[N-1-j] = tmp; } max = atoi(num); printf("%d\n", max-min); } return 0; }
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include <stdio.h> | ^ In file included from main.c:2: /usr/include/stdlib.h:98:8: error: unknown type name 'size_t' 98 | extern size_t __ctype_get_mb_cur_max (void) __THROW __wur; | ^~~~~~ /usr/include/stdlib.h:57:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' 56 | #include <bits/floatn.h> +++ |+#include <stddef.h> 57 | /usr/include/stdlib.h:531:25: error: unknown type name 'size_t' 531 | size_t __statelen) __THROW __nonnull ((2)); | ^~~~~~ /usr/include/stdlib.h:531:25: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:561:25: error: unknown type name 'size_t' 561 | size_t __statelen, | ^~~~~~ /usr/include/stdlib.h:561:25: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:661:42: error: unknown type name 'size_t' 661 | extern void arc4random_buf (void *__buf, size_t __size) | ^~~~~~ /usr/include/stdlib.h:661:42: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:672:22: error: unknown type name 'size_t' 672 | extern void *malloc (size_t __size) __THROW __attribute_malloc__ | ^~~~~~ /usr/include/stdlib.h:672:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:675:22: error: unknown type name 'size_t' 675 | extern void *calloc (size_t __nmemb, size_t __size) | ^~~~~~ /usr/include/stdlib.h:675:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:675:38: error: unknown type name 'size_t' 675 | extern void *calloc (size_t __nmemb, size_t __size) | ^~~~~~ /usr/include/stdlib.h:675:38: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:683:36: error: unknown type name 'size_t' 683 | extern void *realloc (void *__ptr, size_t __size) | ^~~~~~ /usr/include/stdlib.h:683:36: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:695:41: error: unknown type name 'size_t' 695 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) | ^~~~~~ /usr/include/stdlib.h:695:41: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:695:57: error: unknown type name 'size_t' 695 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) | ^~~~~~ /usr/include/stdlib.h:695:57: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:701:41: error: unknown type name 'size_t' 701 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) | ^~~~~~ /usr/include/stdlib.h:701:41: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:701:57: error: unknown type name 'size_t' 701 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) | ^~~~~~ /usr/include/stdlib.h:701:57: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' In file included from /usr/include/stdlib.h:706: /usr/include/alloca.h:32:22: error: unknown type name 'size_t' 32 | extern void *alloca (size_t __size) __THROW; | ^~~~~~ /usr/include/alloca.h:25:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' 24 | #include <stddef.h> +++ |+#include <stddef.h> 25 | /usr/include/stdlib.h:712:22: error: unknown type name 'size_t' 712 | extern void *valloc (size_t __size) __THROW __attribute_malloc__ | ^~~~~~ /usr/include/stdlib.h:712:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:718:45: error: unknown type name 'size_t' 718 | extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) | ^~~~~~ /usr/include/stdlib.h:718:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:718:65: error: unknown type name 'size_t' 718 | extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) | ^~~~~~ /usr/include/stdlib.h:718:65: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:724:29: error: unknown type name 'size_t' 724 | extern void *aligned_alloc (size_t __alignment, size_t __size) | ^~~~~~ /usr/include/stdlib.h:724:29: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:724:49: error: unknown type name 'size_t' 724 | extern void *aligned_alloc (size_t __alignment, size_t __size) | ^~~~~~ /usr/include/stdlib.h:724:49: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:961:23: error: unknown type name 'size_t' 961 | size_t __nmemb, size_t __size, __compar_fn_t __compar) | ^~~~~~ /usr/include/stdlib.h:961:23: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:961:39: error: unknown type name 'size_t' 961 | size_t __nmemb, size_t __size, __compar_fn_t __compar) | ^~~~~~ /usr/include/stdlib.h:961:39: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:970:34: error: unknown type name 'size_t' 970 | extern void qsort (void *__base, size_t __nmemb, size_t __size, | ^~~~~~ /usr/include/stdlib.h:970:34: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:970:50: error: unknown type name 'size_t' 970 | extern void qsort (void *__base, size_t __nmemb, size_t __size, | ^~~~~~ /usr/include/stdlib.h:970:50: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1044:20: error: unknown type name 'size_t' 1044 | size_t __len) __THROW __nonnull ((3, 4, 5)); | ^~~~~~ /usr/include/stdlib.h:1044:20: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1047:20: error: unknown type name 'size_t' 1047 | size_t __len) __THROW __nonnull ((3, 4, 5)); | ^~~~~~ /usr/include/stdlib.h:1047:20: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1051:45: error: unknown type name 'size_t' 1051 | char *__restrict __buf, size_t __len) | ^~~~~~ /usr/include/stdlib.h:1051:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1055:45: error: unknown type name 'size_t' 1055 | char *__restrict __buf, size_t __len) | ^~~~~~ /usr/include/stdlib.h:1055:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1062:36: error: unknown type name 'size_t' 1062 | extern int mblen (const char *__s, size_t __n) __THROW; | ^~~~~~ /usr/include/stdlib.h:1062:36: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1066:48: error: unknown type name 'size_t' 1066 | const char *__restrict __s, size_t __n) __THROW; | ^~~~~~ /usr/include/stdlib.h:1066:48: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1073:8: error: unknown type name 'size_t' 1073 | extern size_t mbstowcs (wchar_t *__restrict __pwcs, | ^~~~~~ /usr/include/stdlib.h:1073:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1074:53: error: unknown type name 'size_t' 1074 | const char *__restrict __s, size_t __n) __THROW | ^~~~~~ /usr/include/stdlib.h:1074:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/stdlib.h:1077:8: error: unknown type name 'size_t' 1077 | extern size_t wcstombs (char *__restrict __s, | ^~~~~~ /usr/include/stdlib.h:1077:8: note: 'size_t' is defined in header '<stddef.h>'; this is probab
s217792986
p00051
C
#include <stdio.h> using namespace std; #include <iostream> int main(void){ int n, i, j, k; int num[50], high[50], low[50]; char str[50][10], tmp; scanf("%d", &n); for (i=0;i<n;i++) { scanf("%s",str[i]); } for (k=0;k<n;k++) { for (i=0;i<7;i++) { for ( j=7;j>i;j--) { if (str[k][j-1] > str[k][j]) { tmp = str[k][j-1]; str[k][j-1] = str[k][j]; str[k][j] = tmp; } } } low[k]= atoi(str[k]); //printf("%d\n",low[k]); } for (k=0;k<n;k++) { for (i=0;i<7;i++) { for ( j=7;j>i;j--) { if (str[k][j-1] < str[k][j]) { tmp = str[k][j-1]; str[k][j-1] = str[k][j]; str[k][j] = tmp; } } } high[k]= atoi(str[k]); //printf("%d\n",high[k]); } for(i=0;i<n;i++) printf("%d\n", high[i]-low[i]); return 0; }
main.c:2:1: error: unknown type name 'using' 2 | using namespace std; | ^~~~~ main.c:2:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std' 2 | using namespace std; | ^~~ main.c:3:10: fatal error: iostream: No such file or directory 3 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s611391048
p00051
C
#include<stdio.h> void swap(int *x,int *y){ int k; k=*x; *x=*y; *y=k; } int func(int a){ int i,j,x[8],max,min; x[0]=a%10; x[1]=a/10%10; x[2]=a/100%10; x[3]=a/1000%10; x[4]=a/10000%10; x[5]=a/100000%10; x[6]=a/1000000%10; x[7]=a/10000000%10; for(j=0;j<8;j++) for(i=0;i<7;i++) if(x[i]<x[i+1])swap(&x[i],&x[i+1]) min=10000000*x[7]+1000000*x[6]+100000*x[5]+10000*x[4]+1000*x[3]+100*x[2]+10*x[1]+x[0]; max=10000000*x[0]+1000000*x[1]+100000*x[2]+10000*x[3]+1000*x[4]+100*x[5]+10*x[6]+x[7]; return max-min; } int main(){ int n,a; scanf("%d",&n); while(n-->0){ scanf("%d",&a); printf("%d\n",func(a)); } return 0; }
main.c: In function 'func': main.c:20:35: error: expected ';' before 'min' 20 | if(x[i]<x[i+1])swap(&x[i],&x[i+1]) | ^ | ; 21 | min=10000000*x[7]+1000000*x[6]+100000*x[5]+10000*x[4]+1000*x[3]+100*x[2]+10*x[1]+x[0]; | ~~~