submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s959124260 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int a=0;
for(int i=0; i < s.size(); i++){
if(s.at(i)=="A"){
int b=0;
for(int j=s.at(i); j < s.size(); j++){
b++;
if(s.at(i)=="Z"){
if(a < b) b=a;
break;
}
}
}
}
cout << a << endl;
} | a.cc: In function 'int main()':
a.cc:8:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
8 | if(s.at(i)=="A"){
| ~~~~~~~^~~~~
a.cc:12:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
12 | if(s.at(i)=="Z"){
| ~~~~~~~^~~~~
|
s949717614 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int a=0;
for(int i=0; i < s.size(); i++){
if(s.at(i)==A){
int b=0;
for(int j=s.at(i); j < s.size(); j++){
b++;
if(s.at(i)==Z){
if(a < b) b=a;
break;
}
}
}
}
cout << a << endl;
} | a.cc: In function 'int main()':
a.cc:8:17: error: 'A' was not declared in this scope
8 | if(s.at(i)==A){
| ^
a.cc:12:21: error: 'Z' was not declared in this scope
12 | if(s.at(i)==Z){
| ^
|
s159282668 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
int int_len(int n) {
int s=0;
while(n!=0) s++, n/=10;
return s;
}
int int_sum(int n) {
int m=0,s=0,a=n;
while(a!=0) s++, a/=10;
for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
return m;
}
int fac(int n){
int m=1;
while(n>=1) m*=n,n--;
return m;
}
int vec_sum(vector<int> v){
int n=0;
for(int i=0;i<v.size();i++) n+=v[i];
return n;
}
///////////////////////////
int main() {
string s,a=200010,z=0;
cin>>s;
rep(i,s.size()){
if(s[i]=='A') a=min(a,i);
if(s[i]=='Z') z=max(z,i);
}
cout<<z-a+1<<endl;
}
/////////////////////////// | a.cc: In function 'int main()':
a.cc:31:14: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
31 | string s,a=200010,z=0;
| ^~~~~~
a.cc:34:24: error: no matching function for call to 'min(std::string&, int&)'
34 | if(s[i]=='A') a=min(a,i);
| ~~~^~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:34:24: note: deduced conflicting types for parameter 'const _Tp' ('std::__cxx11::basic_string<char>' and 'int')
34 | if(s[i]=='A') a=min(a,i);
| ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:34:24: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::initializer_list<_Tp>'
34 | if(s[i]=='A') a=min(a,i);
| ~~~^~~~~
a.cc:35:24: error: no matching function for call to 'max(std::string&, int&)'
35 | if(s[i]=='Z') z=max(z,i);
| ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:35:24: note: deduced conflicting types for parameter 'const _Tp' ('std::__cxx11::basic_string<char>' and 'int')
35 | if(s[i]=='Z') z=max(z,i);
| ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:35:24: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::initializer_list<_Tp>'
35 | if(s[i]=='Z') z=max(z,i);
| ~~~^~~~~
a.cc:37:10: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
37 | cout<<z-a+1<<endl;
| ~^~
| | |
| | basic_string<[...]>
| basic_string<[...]>
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
a.cc:37:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
37 | cout<<z-a+1<<endl;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
a.cc:37:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
37 | cout<<z-a+1<<endl;
| ^
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)'
370 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:370:5: note: template argument deduction/substitution failed:
a.cc:37:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>'
37 | cout<<z-a+1<<endl;
| ^
/usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)'
379 | operator-(const complex<_Tp>& __x, const _Tp& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:379:5: note: template argument deduction/substitution failed:
a.cc:37:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>'
37 | cout<<z-a+1<<endl;
| ^
/usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)'
388 | operator-(const _Tp& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed:
a.cc:37:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>'
37 | cout<<z-a+1<<endl;
| ^
/usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)'
465 | operator-(const complex<_Tp>& __x)
| ^~~~~~~~
/usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:37:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
37 | cout<<z-a+1<<endl;
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:37:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
37 | cout<<z-a+1<<endl;
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:37:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
37 | cout<<z-a+1<<endl;
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std:: |
s579683330 | p03814 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main() {
bool flag = false;
string s;
cin >> s;
int i = 0;
int n = 1;
while (s[i] != 'Z') { | a.cc: In function 'int main()':
a.cc:16:30: error: expected '}' at end of input
16 | while (s[i] != 'Z') {
| ~^
a.cc:16:30: error: expected '}' at end of input
a.cc:9:12: note: to match this '{'
9 | int main() {
| ^
|
s209007834 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
int main() {
string s;
cin >> s;
vector<int> As, Zs;
for (int i = 0; i < s.length(); i++){
if (s[i] == 'A'){
As.push_back(i);
}
else if (s[i] == 'Z') {
Zs.push_back(i);
}
}
cout << Zs[Zs.length() - 1] - As[0] + 1 << endl;
}
| a.cc: In function 'int main()':
a.cc:19:19: error: 'class std::vector<int>' has no member named 'length'
19 | cout << Zs[Zs.length() - 1] - As[0] + 1 << endl;
| ^~~~~~
|
s440558101 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int A,Z;
for (int i = 0; i < s.size(); i++){
if (s[i]=='A'){
A = i;
break;
}
}
for (int i = s.size - 1; i >= 0; i--){
if (s[i]=='Z'){
Z = i;
break;
}
}
cout << Z-A+1;
} | a.cc: In function 'int main()':
a.cc:13:18: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
13 | for (int i = s.size - 1; i >= 0; i--){
| ~~^~~~
| ()
|
s986890104 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
char s[200001];
cin >> s;
int len = strlen(s)
int a_idx, z_idx;
for(int i = 0; i < len; ++i){
if(s[i] == 'A'){
a_idx = i;
break;
}
}
for(int i = 0; i < len; ++i){
if(s[i] == 'Z'){
z_idx = i;
}
}
cout << z_idx - a_idx + 1 << endl;
} | a.cc: In function 'int main()':
a.cc:9:5: error: expected ',' or ';' before 'int'
9 | int a_idx, z_idx;
| ^~~
a.cc:14:13: error: 'a_idx' was not declared in this scope
14 | a_idx = i;
| ^~~~~
a.cc:22:13: error: 'z_idx' was not declared in this scope
22 | z_idx = i;
| ^~~~~
a.cc:26:13: error: 'z_idx' was not declared in this scope
26 | cout << z_idx - a_idx + 1 << endl;
| ^~~~~
a.cc:26:21: error: 'a_idx' was not declared in this scope
26 | cout << z_idx - a_idx + 1 << endl;
| ^~~~~
|
s205627777 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
char s[200001];
cin >> s;
int a_idx, z_idx;
for(int i = 0; i < s.length(); ++i){
if(s[i] == 'A'){
a_idx = i;
break;
}
}
for(int i = 0; i < s.length(); ++i){
if(s[i] == 'Z'){
z_idx = i;
}
}
cout << z_idx - a_idx + 1 << endl;
} | a.cc: In function 'int main()':
a.cc:10:26: error: request for member 'length' in 's', which is of non-class type 'char [200001]'
10 | for(int i = 0; i < s.length(); ++i){
| ^~~~~~
a.cc:18:26: error: request for member 'length' in 's', which is of non-class type 'char [200001]'
18 | for(int i = 0; i < s.length(); ++i){
| ^~~~~~
|
s279896902 | p03814 | Java | static Scanner sc = new Scanner(System.in);public static void main(String args[]){String s = sc.next();System.out.println(s.lastIndexOf('Z')-s.indexOf('A')+1);}} | Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
static Scanner sc = new Scanner(System.in);public static void main(String args[]){String s = sc.next();System.out.println(s.lastIndexOf('Z')-s.indexOf('A')+1);}}
^
(use --enable-preview to enable unnamed classes)
Main.java:1: error: class, interface, enum, or record expected
static Scanner sc = new Scanner(System.in);public static void main(String args[]){String s = sc.next();System.out.println(s.lastIndexOf('Z')-s.indexOf('A')+1);}}
^
2 errors
|
s080490284 | p03814 | C++ | #include <iostream>
#include <cstring>
using namespace std;
int main()
{
string s;
cin >> s;
int foundA = 0;
int mini = 0;
int maxi = 0;
int length = s.length()
for (int i = 0; i < length; i++)
{
if (s[i] == 'A' && foundA == 0)
{
mini = i;
foundA = 1;
}
if (s[i] == 'Z')
{
maxi = i;
}
}
cout << maxi - mini;
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:5: error: expected ',' or ';' before 'for'
14 | for (int i = 0; i < length; i++)
| ^~~
a.cc:14:21: error: 'i' was not declared in this scope
14 | for (int i = 0; i < length; i++)
| ^
|
s237277276 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s; cin >> s;
int a, b; a = b = 0;
for (int i = 0; i < N; i++) {
if (s.at(i) = 'A') {
a = i;
break;
}
}
for (int i = 0; i < N; i++) {
if (s.at(s.size() - 1 - i) = 'Z') {
b = i;
break;
}
}
cout << s.size() - a - b << endl;
}
| a.cc: In function 'int main()':
a.cc:7:23: error: 'N' was not declared in this scope
7 | for (int i = 0; i < N; i++) {
| ^
a.cc:13:23: error: 'N' was not declared in this scope
13 | for (int i = 0; i < N; i++) {
| ^
|
s120729612 | p03814 | C++ | #include <bits/stdc++.h>
#include <math.h>
#include <cmath>
using namespace std;
using std::cout;
using ll =long long;
bool is_int_lround(double x){
return std::lround(x)==x;
}
int ketasuu(int x){
int n=0;
while(x>0){
x /=10 ;
n ++;
}
return n;
}
ll gcd11(ll x, ll y){
long long a= max(x,y), b=min(x,y), c=a%b;
while( c!=0){
a =b;
b =c;
c = a%b;
}
return b;
}
int ab(int x, int y){
if(x>=y){
return x-y;
}
else if(y>x){
return y-x;
}
}
int main(){
int s;
string s;
int a=0,z =0;
for(int i=0;i<s.size();i++){
if(s[i]=='A'){
a =i;
break;
}
}
for(int i=s.size()-1 ; i >=0 ; i--){
if(s[i]=='Z'){
z =i;
break;
}
}
cout << z-a+1<<endl;
} | a.cc: In function 'int main()':
a.cc:39:10: error: conflicting declaration 'std::string s'
39 | string s;
| ^
a.cc:38:7: note: previous declaration as 'int s'
38 | int s;
| ^
a.cc:41:19: error: request for member 'size' in 's', which is of non-class type 'int'
41 | for(int i=0;i<s.size();i++){
| ^~~~
a.cc:42:9: error: invalid types 'int[int]' for array subscript
42 | if(s[i]=='A'){
| ^
a.cc:47:15: error: request for member 'size' in 's', which is of non-class type 'int'
47 | for(int i=s.size()-1 ; i >=0 ; i--){
| ^~~~
a.cc:48:9: error: invalid types 'int[int]' for array subscript
48 | if(s[i]=='Z'){
| ^
a.cc: In function 'int ab(int, int)':
a.cc:36:1: warning: control reaches end of non-void function [-Wreturn-type]
36 | }
| ^
|
s249040837 | p03814 | C++ | #include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
int main(){
string s;
cin>>s
int numA,numZ;
for(numA=0;;numA++){
if(s[numA]=='A') break;
}
for(numZ=(int)s.size()-1;;numZ--){
if(s[numZ]=='Z') break;
}
cout<<numZ-numA<<endl;
}
| a.cc: In function 'int main()':
a.cc:17:9: error: expected ';' before 'int'
17 | cin>>s
| ^
| ;
18 | int numA,numZ;
| ~~~
a.cc:19:7: error: 'numA' was not declared in this scope
19 | for(numA=0;;numA++){
| ^~~~
a.cc:23:7: error: 'numZ' was not declared in this scope
23 | for(numZ=(int)s.size()-1;;numZ--){
| ^~~~
a.cc:27:9: error: 'numZ' was not declared in this scope
27 | cout<<numZ-numA<<endl;
| ^~~~
a.cc:27:14: error: 'numA' was not declared in this scope
27 | cout<<numZ-numA<<endl;
| ^~~~
|
s858418451 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
int a,z;
if(n==1){printf("0"); return 0;}
for(int i=0;i<n;i++){
if(s[i]=='A'){
a=i;
break;
}
}
for(int i=0;i<n;i++){
if(s[i]=='Z'){
z=i;
}
}
printf("%d",z-a+1);
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:8: error: 'n' was not declared in this scope
10 | if(n==1){printf("0"); return 0;}
| ^
a.cc:11:19: error: 'n' was not declared in this scope
11 | for(int i=0;i<n;i++){
| ^
a.cc:17:19: error: 'n' was not declared in this scope
17 | for(int i=0;i<n;i++){
| ^
|
s864056822 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
string s;
int main () {
cin >> s;
int number_a = 0, number_b = 0;
for (int i = 0; i < s.length(); i++){
if (s[i] == 'A'){
number_a = i;
break;
}
}
for (int i = s.length(); i>=0; i--){
if (s[i] == 'Z'){
number_z = i;
break;
}
}
cout << number_z - number_a + 1 << endl;
} | a.cc: In function 'int main()':
a.cc:17:7: error: 'number_z' was not declared in this scope; did you mean 'number_b'?
17 | number_z = i;
| ^~~~~~~~
| number_b
a.cc:21:11: error: 'number_z' was not declared in this scope; did you mean 'number_b'?
21 | cout << number_z - number_a + 1 << endl;
| ^~~~~~~~
| number_b
|
s353787660 | p03814 | C++ | #include<iostream>
#include<string>
using namespace std;
index_a=0, index_z=0;
int main(){
string s;cin>>s;
for(int i=0;i<s.size();i++){if(s[i]=='A'){index_a=i;break;}}
for(int i=0;i<s.size();i++){if(s[i]=='Z')index_z=i;}
cout<<index_z-index_a+1<<endl;
} | a.cc:4:1: error: 'index_a' does not name a type
4 | index_a=0, index_z=0;
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:45: error: 'index_a' was not declared in this scope
7 | for(int i=0;i<s.size();i++){if(s[i]=='A'){index_a=i;break;}}
| ^~~~~~~
a.cc:8:44: error: 'index_z' was not declared in this scope
8 | for(int i=0;i<s.size();i++){if(s[i]=='Z')index_z=i;}
| ^~~~~~~
a.cc:9:9: error: 'index_z' was not declared in this scope
9 | cout<<index_z-index_a+1<<endl;
| ^~~~~~~
a.cc:9:17: error: 'index_a' was not declared in this scope
9 | cout<<index_z-index_a+1<<endl;
| ^~~~~~~
|
s210135234 | p03814 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
string S;cin>>S;
int N=S.size();
for (int i =0;i<N;++i){
if (S[i]=='A'){
int SA=i;
break;
}
}
for (int j =N;j>0;--j){
if (S[j]=='Z'){
int SZ=N-j;
break;
}
}
cout<<SZ-SA<<endl;
}
| a.cc: In function 'int main()':
a.cc:21:9: error: 'SZ' was not declared in this scope; did you mean 'S'?
21 | cout<<SZ-SA<<endl;
| ^~
| S
a.cc:21:12: error: 'SA' was not declared in this scope; did you mean 'S'?
21 | cout<<SZ-SA<<endl;
| ^~
| S
|
s463609928 | p03814 | Java | import java.util.*;
public class Main{
public static void main(String[]args){
Scanner sc = new Scanner(System.in);
String S = sc.next();
int s = S.length();
int a = -1, z = 0;
for(int i = 0; i < s; i++){
if(S.charAt(i) == 'A' && a == -1){
a = i;
}else if(S.charAt('Z')){
z = i;
}
}
System.out.println(z-a+1);
}
} | Main.java:12: error: incompatible types: char cannot be converted to boolean
}else if(S.charAt('Z')){
^
1 error
|
s189532078 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
string s;
cin>>s;
int a,z;
rep(i,N){
if (s[i]=='A') a=i;
if (s[s.size()-1-i]=='Z') z=i;
}
cout<<z-a+1<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:9: error: 'N' was not declared in this scope
10 | rep(i,N){
| ^
a.cc:3:45: note: in definition of macro 'rep'
3 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
| ^
|
s969087499 | p03814 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s = sc.next();
char[] array = s.toCharArray();
int first = 0;
int end = s.length();
for(int i = 0;i < end;i++){
if(s.substring(i,i+1).equals("A")){
first = i+1;
break;
}
}
for(int i = end;i > 0;i--){
if(s.substring(i-1,i)){
end = i;
break;
}
}
System.out.println(end-first+1);
}
} | Main.java:16: error: incompatible types: String cannot be converted to boolean
if(s.substring(i-1,i)){
^
1 error
|
s208244432 | p03814 | C++ | #include<iostream>
#include<string>
using namespace std ;
int main(){
string s,rs ;
int i,j_1,j_2 ;
cin >> s ;
rs = reverse(s.bigin(),s.end()) ;
for(i=0;i<s.length();i++){
if(s[i]=='A'){
j_1=i;
break ;
}
}
for(i=0;i<rs.length();i++){
if(s[i]=='Z'){
j_2=i;
break ;
}
}
cout << (s.length()-1-j_2)-j_1+1 << endl;
} | a.cc: In function 'int main()':
a.cc:11:18: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'bigin'; did you mean 'begin'?
11 | rs = reverse(s.bigin(),s.end()) ;
| ^~~~~
| begin
a.cc:11:8: error: 'reverse' was not declared in this scope
11 | rs = reverse(s.bigin(),s.end()) ;
| ^~~~~~~
|
s315169657 | p03814 | C++ | #include<iostream>
#include<cstring>
int main(){
string s,rs ;
int i,j_1,j_2 ;
std::cin >> s ;
rs = reverse(s.bigin(),s.end()) ;
for(i=0;i<s.length();i++){
if(s[i]=='A'){
j_1=i;
break ;
}
}
for(i=0;i<rs.length();i++){
if(s[i]=='Z'){
j_2=i;
break ;
}
}
std::cout << (s.length()-1-j_2)-j_1+1 << std::endl;
} | a.cc: In function 'int main()':
a.cc:5:3: error: 'string' was not declared in this scope
5 | string s,rs ;
| ^~~~~~
a.cc:5:3: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/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:8:15: error: 's' was not declared in this scope
8 | std::cin >> s ;
| ^
a.cc:10:3: error: 'rs' was not declared in this scope
10 | rs = reverse(s.bigin(),s.end()) ;
| ^~
a.cc:10:8: error: 'reverse' was not declared in this scope
10 | rs = reverse(s.bigin(),s.end()) ;
| ^~~~~~~
|
s141114849 | p03814 | C++ | #include<iostream>
#include<cstring>
using namespace std ;
int main(){
string s,rs ;
int i,j_1,j_2 ;
cin >> s ;
rs = reverse(s.bigin(),s.end()) ;
for(i=0;i<s.length();i++){
if(s[i]=='A'){
j_1=i;
break ;
}
}
for(i=0;i<rs.length();i++){
if(s[i]=='Z'){
j_2=i;
break ;
}
}
cout << (s.length()-1-j_2)-j_1+1 << endl;
} | a.cc: In function 'int main()':
a.cc:11:18: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'bigin'; did you mean 'begin'?
11 | rs = reverse(s.bigin(),s.end()) ;
| ^~~~~
| begin
a.cc:11:8: error: 'reverse' was not declared in this scope
11 | rs = reverse(s.bigin(),s.end()) ;
| ^~~~~~~
|
s612186560 | p03814 | C++ | #include<iostream>
#include<cstring>
using namespace std ;
int main(){
string s,rs ;
int i,j_1,j_2 ;
cin >> s ;
rs = reverse(s.bigin(),s.end())
for(i=0;i<s.length();i++){
if(s[i]=='A'){
j_1=i;
break ;
}
}
for(i=0;i<rs.length();i++){
if(s[i]=='Z'){
j_2=i;
break ;
}
}
cout << (s.length()-1-j_2)-j_1+1 << endl;
} | a.cc: In function 'int main()':
a.cc:11:18: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'bigin'; did you mean 'begin'?
11 | rs = reverse(s.bigin(),s.end())
| ^~~~~
| begin
a.cc:11:8: error: 'reverse' was not declared in this scope
11 | rs = reverse(s.bigin(),s.end())
| ^~~~~~~
a.cc:13:27: error: expected ';' before ')' token
13 | for(i=0;i<s.length();i++){
| ^
| ;
|
s711085597 | p03814 | C++ | #include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
int main() {
stirng s;
cin >> s;
int n=s.size();
int i,j;
for(int k=0;k<n;k++){
if(s.at(k) == 'A'){
i = k;
break;
}
}
for(int k=n-1;k>0;k--){
if(s.at(k) =='Z'){
j = k;
break;
}
}
for(int k=i;k<=j;k++){
cout << s.at(k);
}
cout << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:3: error: 'stirng' was not declared in this scope
7 | stirng s;
| ^~~~~~
a.cc:8:10: error: 's' was not declared in this scope
8 | cin >> s;
| ^
|
s874441329 | p03814 | C++ | #include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>
#include <string>
#include <sstream>
#include <cctype>
using namespace std;
int main(){
string s;
int front = 0;
int back = n-1;
for(int i = 0; i < n; i++){
if(s[i] == 'A'){
front = i;
break;
}
}
for(int i = n - 1; i >= 0; i++){
if(s[i] == 'Z'){
back = i;
break;
}
}
cout << back - front + 1 << endl;
}
| a.cc: In function 'int main()':
a.cc:17:14: error: 'n' was not declared in this scope
17 | int back = n-1;
| ^
|
s274364864 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
int main(){
string S;
cin >> S;
int N = S.size();
int a, b;
for(int i = 0; i < N; i++){
if(S.at(i) == 'A'){
a = i;
break;
}
}
for(int i = N - 1; i >= 0; i--){
if(S.at(i) == 'Z'){
b = i;
break;
}
int ans = b - a + 1;
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:24:2: error: expected '}' at end of input
24 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s630114063 | p03814 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string s
cin >> s;
auto posA = s.find("A");
auto posB = s.rfind("Z");
cout << posB - posA + 1 << endl;
}
| a.cc: In function 'int main()':
a.cc:10:3: error: expected initializer before 'cin'
10 | cin >> s;
| ^~~
a.cc:12:15: error: 's' was not declared in this scope
12 | auto posA = s.find("A");
| ^
|
s240168033 | p03814 | C++ | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
// your code goes her
string s;
cin >> s;
vector<char> vec;
for (int i=0;i<s.length();i++){
vec.push_back(s[i]);
}
int a_cnt=0;
int z_cnt =0;
for (int i=0;i<s.length();i++){
if (vec[i]==“A”){
a_cnt =i;
break;
}
}
for (int i=0;i<s.length();i++){
if (vec[i] == “Z”)z_cnt =i;
}
cout << z_cnt -a_cnt +1 << endl;
return 0;
} | a.cc:20:13: error: extended character “ is not valid in an identifier
20 | if (vec[i]==“A”){
| ^
a.cc:20:13: error: extended character ” is not valid in an identifier
a.cc:26:15: error: extended character “ is not valid in an identifier
26 | if (vec[i] == “Z”)z_cnt =i;
| ^
a.cc:26:15: error: extended character ” is not valid in an identifier
a.cc: In function 'int main()':
a.cc:20:13: error: '\U0000201cA\U0000201d' was not declared in this scope
20 | if (vec[i]==“A”){
| ^~~
a.cc:26:15: error: '\U0000201cZ\U0000201d' was not declared in this scope
26 | if (vec[i] == “Z”)z_cnt =i;
| ^~~
|
s275878481 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s; cin >> s;
int start=0,end=0,ans=0,count=0;
for(int i=0;i<s.size();i++) {
int count=0;
if(s[i]=="A"){
start=i;
}
if(s[i]=="Z"){
end=i;
count=end-start;
ans=max(count,ans);
start=200001; end=0;
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:9:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
9 | if(s[i]=="A"){
a.cc:12:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
12 | if(s[i]=="Z"){
|
s276650449 | p03814 | C++ | int main() {
string s;
cin >> s;
vector<char> S(s.size());
for (int i=0;i<s.size();i++) {
S.at(i) = s[i];
}
bool cntchk = false;
int cnt,cnta,cntz;
int i = 0;
while (true) {
cnta = i;
if (S.at(i) == 'A') break;
i++;
}
reverse(S.begin(),S.end());
int j = 0;
while (true) {
cntz = j;
if (S.at(j) == 'Z') break;
j++;
}
cnt = s.size() - cnta - cntz;
cout << cnt << endl;
} | a.cc: In function 'int main()':
a.cc:2:5: error: 'string' was not declared in this scope
2 | string s;
| ^~~~~~
a.cc:3:5: error: 'cin' was not declared in this scope
3 | cin >> s;
| ^~~
a.cc:3:12: error: 's' was not declared in this scope
3 | cin >> s;
| ^
a.cc:4:5: error: 'vector' was not declared in this scope
4 | vector<char> S(s.size());
| ^~~~~~
a.cc:4:12: error: expected primary-expression before 'char'
4 | vector<char> S(s.size());
| ^~~~
a.cc:6:9: error: 'S' was not declared in this scope
6 | S.at(i) = s[i];
| ^
a.cc:13:13: error: 'S' was not declared in this scope
13 | if (S.at(i) == 'A') break;
| ^
a.cc:16:13: error: 'S' was not declared in this scope
16 | reverse(S.begin(),S.end());
| ^
a.cc:16:5: error: 'reverse' was not declared in this scope
16 | reverse(S.begin(),S.end());
| ^~~~~~~
a.cc:24:5: error: 'cout' was not declared in this scope
24 | cout << cnt << endl;
| ^~~~
a.cc:24:20: error: 'endl' was not declared in this scope
24 | cout << cnt << endl;
| ^~~~
|
s314818996 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;
int x, y;
for( int i=0; i<s.length(); i++){
if (s[i]=='A'){
x=s.find_first_of("A");
}
if (s[i]=='z'){
y=s.find_last_of ("z")
}
}
cout <<y-x+1;
return 0;
}
| a.cc: In function 'int main()':
a.cc:16:31: error: expected ';' before '}' token
16 | y=s.find_last_of ("z")
| ^
| ;
17 |
18 | }
| ~
|
s789691549 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int a,z;
for(int i = 0; true; i++){
if(s.at(i) == 'A'){
a = i + 1;
break;
}
}
for(int i = n - 1; true; i--){
if(s.at(i) == 'Z'){
z = i + 1;
break;
}
}
cout << z - a + 1 << endl;
}
| a.cc: In function 'int main()':
a.cc:14:15: error: 'n' was not declared in this scope
14 | for(int i = n - 1; true; i--){
| ^
|
s172778302 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;
int a=0,z=0;
for(int i = 0; i <= s.size() ; i++){
if(s[i] == 'A' and a <= i){a = i;}
else if(s[i] == 'Z'and z <= i){z =i;}
}
cout << z-a+1 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:11:21: error: unable to find character literal operator 'operator""and' with 'char' argument
11 | else if(s[i] == 'Z'and z <= i){z =i;}
| ^~~~~~
a.cc:11:27: error: expected ')' before 'z'
11 | else if(s[i] == 'Z'and z <= i){z =i;}
| ~ ^~
| )
|
s720961999 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;
int a=0,z=0;
for(int i = 0; i <= s.size() ; i++){
if(s[i] == 'A' and a <= i){a = i;}
else if(s[i] == 'Z'and z <= i){z =i;}
}
cout << z-a+1 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:11:21: error: unable to find character literal operator 'operator""and' with 'char' argument
11 | else if(s[i] == 'Z'and z <= i){z =i;}
| ^~~~~~
a.cc:11:27: error: expected ')' before 'z'
11 | else if(s[i] == 'Z'and z <= i){z =i;}
| ~ ^~
| )
|
s043451408 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;
int a=0,z=0;
for(int i = 0; i <= s.size() ; i++){
if(s[i] == 'A' and i <= a){a = i;}
else if(s[i] == 'Z'and z <= i){z =i;}
}
cout << z-a+1 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:11:21: error: unable to find character literal operator 'operator""and' with 'char' argument
11 | else if(s[i] == 'Z'and z <= i){z =i;}
| ^~~~~~
a.cc:11:27: error: expected ')' before 'z'
11 | else if(s[i] == 'Z'and z <= i){z =i;}
| ~ ^~
| )
|
s148295039 | p03814 | C++ | #include<stdio.h>
#include<string.h>
int main()
{
char s[200001];
int i,l,a,z;
gets(s);
l = strlen(s);
for(i=0; ; i++){
if(s[i]=='A'){
a=i;
break;
}
}
for(i=l-1; ; i--){
if(s[i]=='Z'){
z=i;
break;
}
}
printf("%d", (z-a)+1);
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
7 | gets(s);
| ^~~~
| getw
|
s814730928 | p03814 | C++ | #include<iostream>
using namespace std;
int main()
{
string s;
int ans=0;
getline(cin,s);
for(int i=0 ;i<=s.length() ;i++ ){
if(s[i]=='A'){
for(int j=0 ;j<=s.length() ;j++ ){
if(s[i]=='Z'){
ans=(j-i)+1;
}
}
if(ans!=0){
cout<<ans;
break ;}
}}
| a.cc: In function 'int main()':
a.cc:22:3: error: expected '}' at end of input
22 | }}
| ^
a.cc:4:1: note: to match this '{'
4 | {
| ^
|
s679798707 | p03814 | C++ | string s;
int c=0;
getline(cin,s);
for(int i=0 ;i<=s.length() ;i++ )
if(s[i]=='A'){
for(int j=0 ;j<=s.length() ;j++ ){
if(s[i]=='Z'){
c =(j-i)+1;
}
}
}
if(c !=0){
cout<<c;
break ;}
}}
| a.cc:1:1: error: 'string' does not name a type
1 | string s;
| ^~~~~~
a.cc:3:13: error: expected constructor, destructor, or type conversion before '(' token
3 | getline(cin,s);
| ^
a.cc:4:5: error: expected unqualified-id before 'for'
4 | for(int i=0 ;i<=s.length() ;i++ )
| ^~~
a.cc:4:18: error: 'i' does not name a type
4 | for(int i=0 ;i<=s.length() ;i++ )
| ^
a.cc:4:33: error: 'i' does not name a type
4 | for(int i=0 ;i<=s.length() ;i++ )
| ^
a.cc:12:1: error: expected unqualified-id before 'if'
12 | if(c !=0){
| ^~
a.cc:17:1: error: expected declaration before '}' token
17 | }}
| ^
a.cc:17:2: error: expected declaration before '}' token
17 | }}
| ^
|
s795499823 | p03814 | C++ | #include<iostream>
#include<string>
int main() {
std::string s;
std::cin >> s;
int N = s.size();
int st = 0;
int ed = 0;
for (int i = 0; i < N; i++) {
if (s[i] == 'A') {
st = i;
break;
}
}
reverse(s.begin(), s.end());
for (int i = 0; i < N; i++) {
if (s[i] == 'Z') {
ed = i;
break;
}
}
ed = N - ed - 1;
int ans = ed - st + 1;
std::cout << ans << std::endl;
} | a.cc: In function 'int main()':
a.cc:20:9: error: 'reverse' was not declared in this scope
20 | reverse(s.begin(), s.end());
| ^~~~~~~
|
s306633737 | p03814 | C++ | #include<iostream>
#include<string>
int main() {
std::string s;
std::cin >> s;
int N = s.size();
int st = 0;
int ed = 0;
for (int i = 0; i < N; i++) {
if (s[i] == 'A') {
st = i;
break;
}
}
std::reverse(s.begin(), s.end());
for (int i = 0; i < N; i++) {
if (s[i] == 'Z') {
ed = i;
break;
}
}
ed = N - ed - 1;
int ans = ed - st + 1;
std::cout << ans << std::endl;
} | a.cc: In function 'int main()':
a.cc:20:14: error: 'reverse' is not a member of 'std'
20 | std::reverse(s.begin(), s.end());
| ^~~~~~~
|
s436770785 | p03814 | C++ | #include<iostream>
#include<string>
int main() {
std::string s;
std::cin >> s;
int N = s.size();
int st = 0;
int ed = 0;
for (int i = 0; i < N; i++) {
if (s[i] == 'A') {
st = i;
break;
}
}
std::reverse(s.begin(), s.end());
for (int i = 0; i < N; i++) {
if (s[i] == 'Z') {
ed = i;
break;
}
}
ed = N - ed - 1;
int ans = ed - st + 1;
std::cout << ans << std::endl;
} | a.cc: In function 'int main()':
a.cc:20:14: error: 'reverse' is not a member of 'std'
20 | std::reverse(s.begin(), s.end());
| ^~~~~~~
|
s236918767 | p03814 | C++ | #include<iostream >
#include<string>
using namespace std;
int main()
{
int st,n;
string s;
cin>>s;
int l=s.length();
for(int i=0;i<l;i++)
{
if(s[i]=='A')
{
st=i+1;
break;
}
}
for(int i=0;i<l;i++)
{
if(s[i]=='Z')
{
n=i+1;
}
}
cout<<n-st+1<<endl;
return 0;
}
| a.cc:1:9: fatal error: iostream : No such file or directory
1 | #include<iostream >
| ^~~~~~~~~~~
compilation terminated.
|
s280966085 | p03814 | C++ | #include<iostream >
using namespace std;
int main()
{
int st,n;
string s;
cin>>s;
int l=s.length();
for(int i=0;i<l;i++)
{
if(s[i]=='A')
{
st=i+1;
break;
}
}
for(int i=0;i<l;i++)
{
if(s[i]=='Z')
{
n=i+1;
}
}
cout<<n-st+1<<endl;
return 0;
}
| a.cc:1:9: fatal error: iostream : No such file or directory
1 | #include<iostream >
| ^~~~~~~~~~~
compilation terminated.
|
s032054080 | p03814 | C++ | #include<iostream>
using namespace std;
int main()
{
string s;
cin>>s;
int i=0;
for(;s[i]!='A';++i){
}
for(j=s.length();s[j]!='Z';j--){
}
j++;
cout<<j-i<<"\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:10:13: error: 'j' was not declared in this scope
10 | for(j=s.length();s[j]!='Z';j--){
| ^
a.cc:14:1: error: 'j' was not declared in this scope
14 | j++;
| ^
|
s496461240 | p03814 | C++ | #include<iostream >
using namespace std;
int main()
{
int st,e;
string s;
cin>>s;
int l=s.length();
for(int i=0;i<l;i++)
{
if(s[i]=='A')
{
st=i+1;
break;
}
}
for(int i=0;i<l;i++)
{
if(s[i]=='Z')
{
e=i+1;
}
}
cout<<e-st+1<<endl;
return 0;
}
| a.cc:1:9: fatal error: iostream : No such file or directory
1 | #include<iostream >
| ^~~~~~~~~~~
compilation terminated.
|
s099889339 | p03814 | C++ | int max=0,counter=0,m;
string s;
cin>>s;
for(int i=0;i<s.length();i++){
if(s[i]=='A'){
m=i;
if(counter>0)
break;
for(m;m<s.length();m++){
if(s[m]=='Z'){
counter++;
if(counter>max){
max=counter;
}
}
else
counter++;
}
}
}
cout<<max;
return 0;
}
| a.cc:2:1: error: 'string' does not name a type
2 | string s;
| ^~~~~~
a.cc:3:1: error: 'cin' does not name a type
3 | cin>>s;
| ^~~
a.cc:4:1: error: expected unqualified-id before 'for'
4 | for(int i=0;i<s.length();i++){
| ^~~
a.cc:4:13: error: 'i' does not name a type
4 | for(int i=0;i<s.length();i++){
| ^
a.cc:4:26: error: 'i' does not name a type
4 | for(int i=0;i<s.length();i++){
| ^
a.cc:26:1: error: 'cout' does not name a type
26 | cout<<max;
| ^~~~
a.cc:27:1: error: expected unqualified-id before 'return'
27 | return 0;
| ^~~~~~
a.cc:28:1: error: expected declaration before '}' token
28 | }
| ^
|
s148661966 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
//ori
#define MOD 1000000007
int main() {
string s;
cin >> s;
int n, a, Z;
n = SZ(s);
REP(i,n-1) {
if(s.at(i) == 'A') a=i;
break;
}
REP(i,n-1) {
if(s.at(n-1-i) == 'Z') z=i;
break;
}
int ans = z-a+1;
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:41:28: error: 'z' was not declared in this scope
41 | if(s.at(n-1-i) == 'Z') z=i;
| ^
a.cc:44:13: error: 'z' was not declared in this scope
44 | int ans = z-a+1;
| ^
|
s749667505 | p03814 | C++ | l#include<bits/stdc++.h>
using namespace std;
int main()
{
int x,st,e;
string s;
cin>>s;
int l=s.length();
for(int i=0;i<l;i++)
{
if(s[i]=='A')
{
st=i+1;
break;
}
}
for(int i=0;i<l;i++)
{
if(s[i]=='Z')
{
e=i+1;
}
}
x=e-st+1;
cout<<x<<endl;
return 0;
} | a.cc:1:2: error: stray '#' in program
1 | l#include<bits/stdc++.h>
| ^
a.cc:1:1: error: 'l' does not name a type
1 | l#include<bits/stdc++.h>
| ^
a.cc: In function 'int main()':
a.cc:6:5: error: 'string' was not declared in this scope
6 | string s;
| ^~~~~~
a.cc:7:5: error: 'cin' was not declared in this scope
7 | cin>>s;
| ^~~
a.cc:7:10: error: 's' was not declared in this scope
7 | cin>>s;
| ^
a.cc:25:5: error: 'cout' was not declared in this scope
25 | cout<<x<<endl;
| ^~~~
a.cc:25:14: error: 'endl' was not declared in this scope
25 | cout<<x<<endl;
| ^~~~
|
s037839637 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int e,r,a=0;
string s;
cin>>s;
e=s.find("A");
x=s.rfind("Z");
a=(r-e)+1;
cout<<a;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:9: error: 'x' was not declared in this scope
9 | x=s.rfind("Z");
| ^
|
s347645013 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<char,char> PCC;
typedef pair<ll,ll> PLL;
typedef pair<char,int> PCI;
typedef pair<int,char> PIC;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<ll,char> PLC;
typedef pair<char,ll> PCL;
inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}
int main(void){
SPEEDUP
cout << setprecision(15);
string s;cin >> S;
int si = -1, ei = 0;
rep(i,s.length()){
if(si == -1 && s[i] == 'A') si = i;
if(si != -1 && s[i] == 'Z') ei = i;
}
cout << ei +1 - si << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:35:19: error: 'S' was not declared in this scope
35 | string s;cin >> S;
| ^
|
s620206993 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
if(s.find("A")<s.rfind("Z"))
{
string y=s.substr(s.find("A"),((s.rfind("Z")-
(s.find("A"))+1);
cout<<y.length();
}
else
cout<<0;
} | a.cc: In function 'int main()':
a.cc:9:21: error: expected ')' before ';' token
9 | (s.find("A"))+1);
| ^
| )
a.cc:8:31: note: to match this '('
8 | string y=s.substr(s.find("A"),((s.rfind("Z")-
| ^
a.cc:9:21: error: expected ')' before ';' token
9 | (s.find("A"))+1);
| ^
| )
a.cc:8:18: note: to match this '('
8 | string y=s.substr(s.find("A"),((s.rfind("Z")-
| ^
|
s514458853 | p03814 | C++ | #include<iostream>
using namespace std;
int main()
{
int x,y;
string s;
cin>>s;
for(int i=0;i<s;i++)
{
if(s[i]=='A')
{
x=i+1;
}
if(s[i]=='Z')
{
y=i+1;
}
}
cout<<x-y<<endl;
}
| a.cc: In function 'int main()':
a.cc:8:18: error: no match for 'operator<' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
8 | for(int i=0;i<s;i++)
| ~^~
| | |
| | std::string {aka std::__cxx11::basic_string<char>}
| int
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
a.cc:8:19: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
8 | for(int i=0;i<s;i++)
| ^
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
a.cc:8:19: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
8 | for(int i=0;i<s;i++)
| ^
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
a.cc:8:19: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
8 | for(int i=0;i<s;i++)
| ^
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
a.cc:8:19: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
8 | for(int i=0;i<s;i++)
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
a.cc:8:19: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
8 | for(int i=0;i<s;i++)
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
a.cc:8:19: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
8 | for(int i=0;i<s;i++)
| ^
/usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
a.cc:8:19: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
8 | for(int i=0;i<s;i++)
| ^
/usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
a.cc:8:19: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
8 | for(int i=0;i<s;i++)
| ^
/usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed:
a.cc:8:19: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
8 | for(int i=0;i<s;i++)
| ^
/usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed:
a.cc:8:19: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
8 | for(int i=0;i<s;i++)
| ^
/usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3901 | operator<(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed:
a.cc:8:19: note: mismatched types 'const _CharT*' and 'int'
8 | for(int i=0;i<s;i++)
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2600 | operator<(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed:
a.cc:8:19: note: mismatched types 'const std::tuple<_UTypes ...>' and 'int'
8 | for(int i=0;i<s;i++)
| ^
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:324:3: note: candidate: 'bool std::operator<(const error_code&, const error_code&)'
324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept
| ^~~~~~~~
/usr/include/c++/14/system_error:324:31: note: no known conversion for argument 1 from 'int' to 'const std::error_code&'
324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept
| ~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/system_error:507:3: note: candidate: 'bool std::operator<(const error_condition&, const error_condition&)'
507 | operator<(const error_condition& __lhs,
| ^~~~~~~~
/usr/include/c++/14/system_error:507:36: note: no known conversion for argument 1 from 'int' to 'const std::error_condition&'
507 | operator<(const error_condition& __lhs,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
|
s619981700 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
if(s.find("A")<s.rfind("Z"))
{
cout<<(s.rfind("Z")-(s.find("A"))+1;
}
else
cout<<0;
} | a.cc: In function 'int main()':
a.cc:8:36: error: expected ')' before ';' token
8 | cout<<(s.rfind("Z")-(s.find("A"))+1;
| ~ ^
| )
|
s721296577 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
if((s.find("A"))>(s.rfind("Z"))
{
string y=s.substr(s.find("A"),s.rfind("Z"));
cout<<y.length();
}
else
cout<<0;
} | a.cc: In function 'int main()':
a.cc:6:32: error: expected ';' before '{' token
6 | if((s.find("A"))>(s.rfind("Z"))
| ^
| ;
7 | {
| ~
a.cc:11:1: error: expected primary-expression before 'else'
11 | else
| ^~~~
a.cc:10:2: error: expected ')' before 'else'
10 | }
| ^
| )
11 | else
| ~~~~
a.cc:6:3: note: to match this '('
6 | if((s.find("A"))>(s.rfind("Z"))
| ^
|
s070193086 | p03814 | C++ | #incude<iostream>
using namespace std;
int main(){
string s;
int x,y;
iny sum=0;
X= s.find("A");
Y= s.Rfind("Z");
for(int i=x;i<=y;i++){
sum++;
}
cout<<sum;
return 0;
} | a.cc:1:2: error: invalid preprocessing directive #incude; did you mean #include?
1 | #incude<iostream>
| ^~~~~~
| include
a.cc: In function 'int main()':
a.cc:5:9: error: 'string' was not declared in this scope
5 | string s;
| ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
+++ |+#include <string>
1 | #incude<iostream>
a.cc:7:9: error: 'iny' was not declared in this scope; did you mean 'int'?
7 | iny sum=0;
| ^~~
| int
a.cc:8:1: error: 'X' was not declared in this scope
8 | X= s.find("A");
| ^
a.cc:8:9: error: 's' was not declared in this scope
8 | X= s.find("A");
| ^
a.cc:9:1: error: 'Y' was not declared in this scope
9 | Y= s.Rfind("Z");
| ^
a.cc:11:9: error: 'sum' was not declared in this scope
11 | sum++;
| ^~~
a.cc:14:1: error: 'cout' was not declared in this scope
14 | cout<<sum;
| ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #incude<iostream>
a.cc:14:7: error: 'sum' was not declared in this scope
14 | cout<<sum;
| ^~~
|
s024949318 | p03814 | C++ | #include <bit/stdc++.h>
using namespace std;
int main(){
string s,y;
cin>>s;
y=s.substr(s.find("A"),s.rfind("Z"));
cout<<y.length();
} | a.cc:1:10: fatal error: bit/stdc++.h: No such file or directory
1 | #include <bit/stdc++.h>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s468771926 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int X,M,U,T;
string N;
cin>>N;
int len=N.length();
for(int i=0;i<len;i++){
if(N[i]=='A'){
X=i;
T=1;
}
if(T==1)
break;
}
for(int y=len;y>0;y--){
if(N[y]=='Z'){
M=y;
U=1;
}
if(U==1)
break;
}
cout<<M-X+1;
}
إنهاء الدردشة
اكتب رسالة...
| a.cc:28:1: error: '\U00000625\U00000646\U00000647\U00000627\U00000621' does not name a type
28 | إنهاء الدردشة
| ^~~~~
|
s411630335 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string x;
cin>>X;
int a=200000,b=0;
for(int i=0;i<200000;i++){
if(x[i]=='A'){
if(i<a){
a=i;
}
}
if(x[i]=='Z'){
if(i>b){
b=i;
}
}
}
if(b>a){
cout<<b-a+1<<endl;
}
}
| a.cc: In function 'int main()':
a.cc:5:8: error: 'X' was not declared in this scope
5 | cin>>X;
| ^
|
s483165718 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int rem_A, rem_Z;
for (int i=0; i<s.size(); i++){
if (s.at(i) = A){
rem_A = i;
break;
}
}
for (int i=s.size()-1; i>=0; i--){
if (s.at(i) = Z){
rem_Z = i;
break;
}
}
cout << rem_Z - rem_A + 1 << endl;
} | a.cc: In function 'int main()':
a.cc:10:19: error: 'A' was not declared in this scope
10 | if (s.at(i) = A){
| ^
a.cc:17:19: error: 'Z' was not declared in this scope
17 | if (s.at(i) = Z){
| ^
|
s281963623 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;cin>>s;
int a,b;
for(int i=;i<s.size();i++){
if(s[i]=='A'){a=i;break;}
}
for(int i=s.size()-1;i>=0;i--){
if(s[i=='Z'){b=i;i--;}
}
cout<<b-a+1<<endl;
} | a.cc: In function 'int main()':
a.cc:7:19: error: expected primary-expression before ';' token
7 | for(int i=;i<s.size();i++){
| ^
a.cc:11:20: error: expected ']' before ')' token
11 | if(s[i=='Z'){b=i;i--;}
| ^
| ]
|
s797270218 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int he, ta;
for (int i=0;;i++){
if(s[i]=='A'){
he=i;
}
}
for (int i=n-1;;i--){
if(s[i]=='Z'){
ta=i;
}
}
cout << ta-he+1 << endl;
}
| a.cc: In function 'int main()':
a.cc:12:14: error: 'n' was not declared in this scope
12 | for (int i=n-1;;i--){
| ^
|
s009631987 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >>s;
int l=s.size();
int mi,ma;
for (int i=0;i<l;i++){
if (s.at(i)=='A'){
mi=i;
break;
}
}
for (int i=l-1;i>-1;i--){
if (s.at(i)=='Z'){
ma=i;
break;
}
}
cout <<mi<<ma<< ma-mi+1<<endl;
}
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >>s;
int l=s.size();
int mi,ma;
for (int i=0;i<l;i++){
if (s.at(i)=='A'){
mi=i;
break;
}
}
for (int i=l-1;i>-1;i--){
if (s.at(i)=='Z'){
ma=i;
break;
}
}
cout << ma-mi+1<<endl;
}
| a.cc:26:5: error: redefinition of 'int main()'
26 | int main(){
| ^~~~
a.cc:4:5: note: 'int main()' previously defined here
4 | int main(){
| ^~~~
|
s136391206 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string S;
cin>>S;
int A,B;
vector<int>ans(S.size());
int sum=0;
for(i=0;i<S.size();i++)
if(S.at(i)=='A'){
A=i;
break;
}
}
for(int i=0;i<S.size();i++){
if(S.at(i)=='Z'){
ans.at(i)++;
}
}
for(int i=S.size()-1;i>=0;i--){
if(S.at(i)=='Z'){
B=i;
break;
}
}
cout<<B-A+1<<endl;
}
| a.cc: In function 'int main()':
a.cc:12:7: error: 'i' was not declared in this scope
12 | for(i=0;i<S.size();i++)
| ^
a.cc: At global scope:
a.cc:21:1: error: expected unqualified-id before 'for'
21 | for(int i=0;i<S.size();i++){
| ^~~
a.cc:21:13: error: 'i' does not name a type
21 | for(int i=0;i<S.size();i++){
| ^
a.cc:21:24: error: 'i' does not name a type
21 | for(int i=0;i<S.size();i++){
| ^
a.cc:29:1: error: expected unqualified-id before 'for'
29 | for(int i=S.size()-1;i>=0;i--){
| ^~~
a.cc:29:22: error: 'i' does not name a type
29 | for(int i=S.size()-1;i>=0;i--){
| ^
a.cc:29:27: error: 'i' does not name a type
29 | for(int i=S.size()-1;i>=0;i--){
| ^
a.cc:36:1: error: 'cout' does not name a type
36 | cout<<B-A+1<<endl;
| ^~~~
a.cc:37:1: error: expected declaration before '}' token
37 | }
| ^
|
s243853929 | p03814 | C++ | #include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
template <class T> using V = vector<T>;
using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(ll)(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
ll sum(ll n) {
ll m=0;
FOR(i,0,20){
m+=n%10;
n/=10;
if(n==0){
break;
}
}
return m;
}
ll combi(ll n,ll m) {
ll ans=1;
rFOR(i,n,n-m){
ans*=i;
}
FOR(i,1,m+1){
ans/=i;
}
return ans;
}
ll lcm(ll a,ll b){
ll n;
n=a/gcd(a,b)*b;
return n;
}
/****************************************\
| Thank you for viewing my code:) |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka |
\****************************************/
signed main() {
st s;
ci(s);
ll a=s.sz;
ll l;
ll r;
FOR(i,0,a){
if(A[i]=='A') {
l=i;
break;
}
}
rFOR(i,a-1,-1){
if(A[i]=='Z'){
r=i;
break;
}
}
co(r-l+1)
} | a.cc: In function 'int main()':
a.cc:82:8: error: 'A' was not declared in this scope
82 | if(A[i]=='A') {
| ^
a.cc:88:8: error: 'A' was not declared in this scope
88 | if(A[i]=='Z'){
| ^
|
s951114455 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(void){
int i,a=0,z;
string s;
cin >> s;
for (i=s.size()-1;i>=0;i--) if (s.at(i)=='A') a=i;
for (i=0;i<size();i++) if (s.at(i)=='Z') z=i;
cout << z-a+1 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:18: error: no matching function for call to 'size()'
8 | for (i=0;i<size();i++) if (s.at(i)=='Z') z=i;
| ~~~~^~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:262:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate expects 1 argument, 0 provided
|
s771737087 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s; cin >> s;
int n=s.size();
int a,b,ans,cnta=0;
for(i=0;i<n;i++){
if(s[i]=='A' &&cnta==0){
a=i;
cnta++;
}
if(s[i]=='Z')b=i;
}
cout << b-a+1 << endl;
} | a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
8 | for(i=0;i<n;i++){
| ^
|
s464852254 | p03814 | C++ | #include<iostream>
using namespace std;
int main() {
string s; cin >> s;
int a_index = -1, z_index = 0;
for (int i = 0; i < S.size(); i++) {
if (a_index == -1 && S[i] == 'A') a_index = i;
else if (S[i] == 'Z') z_index = i;
}
int length = z_index - a_index + 1;
cout << length << endl;
} | a.cc: In function 'int main()':
a.cc:7:23: error: 'S' was not declared in this scope
7 | for (int i = 0; i < S.size(); i++) {
| ^
|
s905449218 | p03814 | C++ | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;
ll mod = pow(10,9) + 7;
int ctoi(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
return 0;
}
char upper(char c){
return c-0x20;
}
char lower(char c){
return c+0x20;
}
int main() {
string s: cin >>> s;
int a=0,z=0;
rep(i,s.size()){
if (a=0){
if (s[i]=='A'){
a = i;
}
}
if (s[i] == 'Z'){
z=i;
}
}
cout << z-a+1 << endl;
} | a.cc: In function 'int main()':
a.cc:30:17: error: found ':' in nested-name-specifier, expected '::'
30 | string s: cin >>> s;
| ^
| ::
a.cc:30:16: error: 's' has not been declared
30 | string s: cin >>> s;
| ^
a.cc:30:23: error: qualified-id in declaration before '>>' token
30 | string s: cin >>> s;
| ^~
a.cc:32:15: error: 's' was not declared in this scope
32 | rep(i,s.size()){
| ^
a.cc:10:39: note: in definition of macro 'rep'
10 | #define rep(i,n) for (int i = 0; i < (n); ++i)
| ^
|
s036126882 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;
int n;
n = s.size();
int a = n, b = 0;
for (int i = 0; i < n; i++)
{
if (s.at[i] == 'A')
{
a = min(a, i);
}
if (s.at[i] == 'Z')
{
b = max(b, i);
}
}
cout <<a-b+1<< endl;
}
| a.cc: In function 'int main()':
a.cc:13:17: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
13 | if (s.at[i] == 'A')
| ^
a.cc:17:17: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
17 | if (s.at[i] == 'Z')
| ^
|
s584327400 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;
int n;
n = s.size();
int a = n, b = 0;
for (int i = 0; i < n; i++)
{
if (s.at[i] == 'A')
{
a = min(a, i);
}
if (s.at[i] == 'Z')
{
b = max(b, i);
}
}
for (int i = a; i <= b; i++)
{
cout << s[i];
}
cout << endl;
}
| a.cc: In function 'int main()':
a.cc:13:17: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
13 | if (s.at[i] == 'A')
| ^
a.cc:17:17: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
17 | if (s.at[i] == 'Z')
| ^
|
s291095140 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;
int n;
n = s.size();
int a = n, b = 0;
for (int i = 0; i > n; i++)
{
if (s.at[i] == 'A')
{
a = min(a, i);
}
if (s.at[i] == 'Z')
{
b = max(b, i);
}
}
for (int i = a; i <= b; i++)
{
cout << s[i];
}
cout << endl;
}
| a.cc: In function 'int main()':
a.cc:13:17: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
13 | if (s.at[i] == 'A')
| ^
a.cc:17:17: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
17 | if (s.at[i] == 'Z')
| ^
|
s443269073 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int s = 0, e;
string ss;
cin >> ss;
int l = ss.size();
for(int i = 0; i < l; i++)
{
if(s[i] == 'A')s = min(s, i);
if(s[i] == 'Z')e = i;
}
printf("%d", e-s+1);
return 0;
} | a.cc: In function 'int main()':
a.cc:11:9: error: invalid types 'int[int]' for array subscript
11 | if(s[i] == 'A')s = min(s, i);
| ^
a.cc:12:9: error: invalid types 'int[int]' for array subscript
12 | if(s[i] == 'Z')e = i;
| ^
|
s369387919 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int s = 0, e;
string s;
cin >> s;
int l = s.size();
for(int i = 0; i < l; i++)
{
if(s[i] == 'A')s = min(s, i);
if(s[i] == 'Z')e = i;
}
printf("%d", e-s+1);
return 0;
} | a.cc: In function 'int main()':
a.cc:6:10: error: conflicting declaration 'std::string s'
6 | string s;
| ^
a.cc:5:7: note: previous declaration as 'int s'
5 | int s = 0, e;
| ^
a.cc:8:13: error: request for member 'size' in 's', which is of non-class type 'int'
8 | int l = s.size();
| ^~~~
a.cc:11:9: error: invalid types 'int[int]' for array subscript
11 | if(s[i] == 'A')s = min(s, i);
| ^
a.cc:12:9: error: invalid types 'int[int]' for array subscript
12 | if(s[i] == 'Z')e = i;
| ^
|
s175623364 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int s = 0, e;
string s;
cin >> s;
for(int i = 0; s[i] != '\0'; i++)
{
if(s[i] == 'A')s = min(s, i);
if(s[i] == 'Z')e = i;
}
printf("%d", e-s+1);
return 0;
} | a.cc: In function 'int main()':
a.cc:6:10: error: conflicting declaration 'std::string s'
6 | string s;
| ^
a.cc:5:7: note: previous declaration as 'int s'
5 | int s = 0, e;
| ^
a.cc:8:19: error: invalid types 'int[int]' for array subscript
8 | for(int i = 0; s[i] != '\0'; i++)
| ^
a.cc:10:9: error: invalid types 'int[int]' for array subscript
10 | if(s[i] == 'A')s = min(s, i);
| ^
a.cc:11:9: error: invalid types 'int[int]' for array subscript
11 | if(s[i] == 'Z')e = i;
| ^
|
s226467100 | p03814 | C++ | #include<iostream>
using namespace std;
int main()
{
string s;
int res=0;
int count=0;
cin>>s;
>>T>>MeyasuKion;
for(int i=0;i<s.size();i++)
{
if(s.at(i)=='a')
{
for(int j=i;j<s.size();j++)
{
if(s.at(j)=='z')
{
res = (j-i)+1;
count = 1;
}
if(count ==1)
{
count = 0;
break;
}
}
}
}
cout<<res<<endl;
} | a.cc: In function 'int main()':
a.cc:11:9: error: expected primary-expression before '>>' token
11 | >>T>>MeyasuKion;
| ^~
a.cc:11:11: error: 'T' was not declared in this scope
11 | >>T>>MeyasuKion;
| ^
a.cc:11:14: error: 'MeyasuKion' was not declared in this scope
11 | >>T>>MeyasuKion;
| ^~~~~~~~~~
|
s789731667 | p03814 | C++ | #include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main(){
string m,n,j,k;
cin>>n;
m=n.size();
for(int i=0;i<m;i++){
if(n[i]=='A'){
j=i
break;
}
}
for(int i=0;i<m;i++){
if(n[m-1-i]=='Z'){
k=m-1-i
break;
}
}
cout<<k-j<<endl;
}
} | a.cc: In function 'int main()':
a.cc:9:16: error: no match for 'operator<' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
9 | for(int i=0;i<m;i++){
| ~^~
| | |
| | std::string {aka std::__cxx11::basic_string<char>}
| int
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
a.cc:9:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
9 | for(int i=0;i<m;i++){
| ^
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
a.cc:9:17: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'int'
9 | for(int i=0;i<m;i++){
| ^
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
a.cc:9:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
9 | for(int i=0;i<m;i++){
| ^
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
a.cc:9:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
9 | for(int i=0;i<m;i++){
| ^
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
a.cc:9:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
9 | for(int i=0;i<m;i++){
| ^
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
a.cc:9:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
9 | for(int i=0;i<m;i++){
| ^
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
a.cc:9:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
9 | for(int i=0;i<m;i++){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
a.cc:9:17: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
9 | for(int i=0;i<m;i++){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
a.cc:9:17: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
9 | for(int i=0;i<m;i++){
| ^
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
a.cc:9:17: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
9 | for(int i=0;i<m;i++){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
a.cc:9:17: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
9 | for(int i=0;i<m;i++){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
a.cc:9:17: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
9 | for(int i=0;i<m;i++){
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
a.cc:9:17: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
9 | for(int i=0;i<m;i++){
| ^
/usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
a.cc:9:17: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
9 | for(int i=0;i<m;i++){
| ^
/usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
a.cc:9:17: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
9 | for(int i=0;i<m;i++){
| ^
/usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed:
a.cc:9:17: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
9 | for(int i=0;i<m;i++){
| ^
/usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution fa |
s378542005 | p03814 | C++ | #include <iostream>
#include <string>
#include <iomanip>
#include <ios>
using namespace std;
int main(void){
string s;
cin >> s;
int n = s.length();
int begin = 0;
int end = 0;
for(int i=0;i<n;i++){
if(s[i] == 'A'){
begun = i;
break;
}
}
for(int i=n-1;i>=0;i--){
if(s[i] == 'Z'){
end = i;
break;
}
}
if(end > begin){
cout << end - begin + 1 << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:17:7: error: 'begun' was not declared in this scope; did you mean 'begin'?
17 | begun = i;
| ^~~~~
| begin
|
s192216990 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
int N;
N = S.size();
int x = 200000;
int y = 0;
for (int i = 0; i < N; i++) {
if (S[i] == 'A') {
x = min (X, i);
}
else if (S[i] == 'Z') {
y = max (y, i);
}
}
cout << y - x + 0;
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:16: error: 'X' was not declared in this scope
13 | x = min (X, i);
| ^
|
s512068920 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
string N;
cin >> N;
for(int i=0;i<N.size();++i){
if(N.at(i)=="A"){
a = i;
}
}
for(int i=N.size();i>=0;--i){
if(N.at(i)=="Z"){
b = i;
}
}
cout << b-a <<endl;
} | a.cc: In function 'int main()':
a.cc:9:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
9 | if(N.at(i)=="A"){
| ~~~~~~~^~~~~
a.cc:14:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
14 | if(N.at(i)=="Z"){
| ~~~~~~~^~~~~
|
s179427669 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
string N;
cin >> N;
for(int i=0;i<N.size();++i){
if(N.at(i)=='A'){
a = N.size(i);
}
}
for(int i=N.size();i>=0;--i){
if(N.at(i)=='Z'){
b = N.size(i);
}
}
cout << b-a <<endl;
} | a.cc: In function 'int main()':
a.cc:10:23: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
10 | a = N.size(i);
| ~~~~~~^~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate expects 0 arguments, 1 provided
a.cc:15:23: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
15 | b = N.size(i);
| ~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate expects 0 arguments, 1 provided
|
s251385743 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
string N;
cin >> N;
for(int i=0;i<N.size();++i){
if(N.at(i)="A"){
a = N.size(i);
}
}
for(int i=N.size();i>0;--i){
if(N.at(i)="Z"){
b = N.size(i);
}
}
cout << b-a<<endl;
} | a.cc: In function 'int main()':
a.cc:9:20: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
9 | if(N.at(i)="A"){
| ^~~
| |
| const char*
a.cc:10:23: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
10 | a = N.size(i);
| ~~~~~~^~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate expects 0 arguments, 1 provided
a.cc:14:20: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
14 | if(N.at(i)="Z"){
| ^~~
| |
| const char*
a.cc:15:23: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
15 | b = N.size(i);
| ~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate expects 0 arguments, 1 provided
|
s407518161 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
string N;
cin >> N;
for(int i=0;i<N.size();++i){
if(N.at(i)=="A"){
a = N.size(i);
}
}
for(int i=N.size();i>0;--i){
if(N.at(i)=="Z"){
b = N.size(i);
}
}
cout << b-a<<endl;
} | a.cc: In function 'int main()':
a.cc:9:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
9 | if(N.at(i)=="A"){
| ~~~~~~~^~~~~
a.cc:10:23: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
10 | a = N.size(i);
| ~~~~~~^~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate expects 0 arguments, 1 provided
a.cc:14:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
14 | if(N.at(i)=="Z"){
| ~~~~~~~^~~~~
a.cc:15:23: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
15 | b = N.size(i);
| ~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate expects 0 arguments, 1 provided
|
s465070094 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
string N;
cin >> N;
for(int i=0; i < N.size();++i){
if(N.at(i) == "A"){
a = i;
}
else if(N.at(i)=="Z"){
b = i;
for(int j=i+1;j<N.size();++j){
if(N.at(j)=="Z"){
b=N.size(j);
else{
break;
}
}
}
}
c=b-a;
}
cout << c <<endl;
} | a.cc:11:15: error: extended character is not valid in an identifier
11 | a = i;
| ^
a.cc:11:15: error: extended character is not valid in an identifier
a.cc:11:15: error: extended character is not valid in an identifier
a.cc:11:15: error: extended character is not valid in an identifier
a.cc:11:15: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:10:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | if(N.at(i) == "A"){
| ~~~~~~~~^~~~~~
a.cc:11:15: error: '\U00003000\U00003000\U00003000\U00003000\U00003000' was not declared in this scope
11 | a = i;
| ^~~~~~~~~~
a.cc:13:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
13 | else if(N.at(i)=="Z"){
| ~~~~~~~^~~~~
a.cc:16:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
16 | if(N.at(j)=="Z"){
| ~~~~~~~^~~~~
a.cc:17:27: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
17 | b=N.size(j);
| ~~~~~~^~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate expects 0 arguments, 1 provided
a.cc:18:15: error: expected '}' before 'else'
18 | else{
| ^~~~
a.cc:16:31: note: to match this '{'
16 | if(N.at(j)=="Z"){
| ^
a.cc: At global scope:
a.cc:27:5: error: 'cout' does not name a type
27 | cout << c <<endl;
| ^~~~
a.cc:28:1: error: expected declaration before '}' token
28 | }
| ^
|
s848480770 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
string N;
cin >> N;
for(int i=0; i < N.size() ;++i){
if(N.at(i) == "A"){
a=i;
}
else if(N.at(i)=="Z"){
b =i;
for(int j=i+1;j<N.size();++j){
if(N.at(j)=="Z"){
b=N.size(j);
else{
break;
}
}
}
}
c=b-a;
}
cout << c <<endl;
} | a.cc:10:13: error: extended character is not valid in an identifier
10 | a=i;
| ^
a.cc:10:13: error: extended character is not valid in an identifier
a.cc:10:13: error: extended character is not valid in an identifier
a.cc:10:13: error: extended character is not valid in an identifier
a.cc:10:13: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:9:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
9 | if(N.at(i) == "A"){
| ~~~~~~~~^~~~~~
a.cc:10:13: error: '\U00003000\U00003000\U00003000\U00003000\U00003000' was not declared in this scope
10 | a=i;
| ^~~~~~~~~~
a.cc:12:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
12 | else if(N.at(i)=="Z"){
| ~~~~~~~^~~~~
a.cc:15:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
15 | if(N.at(j)=="Z"){
| ~~~~~~~^~~~~
a.cc:16:27: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
16 | b=N.size(j);
| ~~~~~~^~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate expects 0 arguments, 1 provided
a.cc:17:15: error: expected '}' before 'else'
17 | else{
| ^~~~
a.cc:15:31: note: to match this '{'
15 | if(N.at(j)=="Z"){
| ^
a.cc: At global scope:
a.cc:26:5: error: 'cout' does not name a type
26 | cout << c <<endl;
| ^~~~
a.cc:27:1: error: expected declaration before '}' token
27 | }
| ^
|
s772636937 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
string N;
cin >> N;
for(int i=0; i < N.size() ;++i){
if(N.at(i) == "A"){
a=N.size(i);
}
else if(N.at(i)=="Z"){
b =N.size(i);
for(int j=N.size(i+1);j<N.size();++j){
if(N.at(j)=="Z"){
b=N.size(j);
else{
break;
}
}
}
}
c=b-a;
}
cout << c <<endl;
} | a.cc:10:21: error: extended character is not valid in an identifier
10 | a=N.size(i);
| ^
a.cc:10:21: error: extended character is not valid in an identifier
a.cc:10:21: error: extended character is not valid in an identifier
a.cc:10:21: error: extended character is not valid in an identifier
a.cc:10:21: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:9:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
9 | if(N.at(i) == "A"){
| ~~~~~~~~^~~~~~
a.cc:10:17: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
10 | a=N.size(i);
| ~~~~~~^~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate expects 0 arguments, 1 provided
a.cc:10:21: error: '\U00003000\U00003000\U00003000\U00003000\U00003000' was not declared in this scope
10 | a=N.size(i);
| ^~~~~~~~~~
a.cc:12:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
12 | else if(N.at(i)=="Z"){
| ~~~~~~~^~~~~
a.cc:13:18: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
13 | b =N.size(i);
| ~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate expects 0 arguments, 1 provided
a.cc:14:28: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int)'
14 | for(int j=N.size(i+1);j<N.size();++j){
| ~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate expects 0 arguments, 1 provided
a.cc:15:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
15 | if(N.at(j)=="Z"){
| ~~~~~~~^~~~~
a.cc:16:27: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
16 | b=N.size(j);
| ~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate expects 0 arguments, 1 provided
a.cc:17:15: error: expected '}' before 'else'
17 | else{
| ^~~~
a.cc:15:31: note: to match this '{'
15 | if(N.at(j)=="Z"){
| ^
a.cc: At global scope:
a.cc:26:5: error: 'cout' does not name a type
26 | cout << c <<endl;
| ^~~~
a.cc:27:1: error: expected declaration before '}' token
27 | }
| ^
|
s510376631 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c; //文字数を宣言
string N; //文字列を宣言
cin >> N; //文字列を代入
for(int i=0; i < N.size() ;++i){ //N文字目までループ
if(N.at(i) == "A"){ //Aが出たときの文字数
a=N.size(i);
}
else if(N.at(i)=="Z"){ //Zが出たときの文字数
b =N.size(i);
for(int j=N.size(i);j<N.size(N);++j){
if(N.at(j)=="Z"){
b=N.size(i);
else{
break;
}
}
}
}
c=b-a;
}
cout << c <<endl;
} | a.cc:8:37: error: extended character is not valid in an identifier
8 | for(int i=0; i < N.size() ;++i){ //N文字目までループ
| ^
a.cc:9:27: error: extended character is not valid in an identifier
9 | if(N.at(i) == "A"){ //Aが出たときの文字数
| ^
a.cc:9:27: error: extended character is not valid in an identifier
a.cc:9:27: error: extended character is not valid in an identifier
a.cc:10:21: error: extended character is not valid in an identifier
10 | a=N.size(i);
| ^
a.cc:10:21: error: extended character is not valid in an identifier
a.cc:10:21: error: extended character is not valid in an identifier
a.cc:10:21: error: extended character is not valid in an identifier
a.cc:10:21: error: extended character is not valid in an identifier
a.cc:12:30: error: extended character is not valid in an identifier
12 | else if(N.at(i)=="Z"){ //Zが出たときの文字数
| ^
a.cc:12:30: error: extended character is not valid in an identifier
a.cc:12:30: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:8:37: error: '\U00003000' was not declared in this scope
8 | for(int i=0; i < N.size() ;++i){ //N文字目までループ
| ^~
a.cc:12:8: error: 'else' without a previous 'if'
12 | else if(N.at(i)=="Z"){ //Zが出たときの文字数
| ^~~~
a.cc:12:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
12 | else if(N.at(i)=="Z"){ //Zが出たときの文字数
| ~~~~~~~^~~~~
a.cc:12:30: error: '\U00003000\U00003000\U00003000' was not declared in this scope
12 | else if(N.at(i)=="Z"){ //Zが出たときの文字数
| ^~~~~~
a.cc:14:28: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
14 | for(int j=N.size(i);j<N.size(N);++j){
| ~~~~~~^~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate expects 0 arguments, 1 provided
a.cc:14:40: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(std::string&)'
14 | for(int j=N.size(i);j<N.size(N);++j){
| ~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate expects 0 arguments, 1 provided
a.cc:15:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
15 | if(N.at(j)=="Z"){
| ~~~~~~~^~~~~
a.cc:16:27: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
16 | b=N.size(i);
| ~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1076 | size() const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate expects 0 arguments, 1 provided
a.cc:17:15: error: expected '}' before 'else'
17 | else{
| ^~~~
a.cc:15:31: note: to match this '{'
15 | if(N.at(j)=="Z"){
| ^
a.cc: At global scope:
a.cc:26:5: error: 'cout' does not name a type
26 | cout << c <<endl;
| ^~~~
a.cc:27:1: error: expected declaration before '}' token
27 | }
| ^
|
s704975159 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string str;
cin >> str;
int count1,count2 = 0;
for (int i = 0; i < str.size(); i++) {
if (str.at(i) == 'A') {
count1=i+1;
break;
}
}
for(int i=str.size()-1;i>0;i--){
if(str.at(i)=='Z'){
count2=i+1;
break;
}
}
cout<<count2-count1+1<<endl;
}
cout << count << endl;
}
| a.cc:25:3: error: 'cout' does not name a type
25 | cout << count << endl;
| ^~~~
a.cc:26:1: error: expected declaration before '}' token
26 | }
| ^
|
s263160432 | p03814 | C++ |
if(S.at(i) == 'A'){
flag = true;
ans++;
}else if(S.at(i) == 'Z' && flag == true){
ans++;
flag2 = true;
}else if(S.at(i) != 'Z' && flag2 == true){
flag = false;
flag2 = false;
max_ans = max(max_ans , ans);
ans = 0;
}else if(flag == true){
ans++;
}
}
max_ans =max(max_ans , ans);
cout << max_ans << endl;
*/
}
| a.cc:2:17: error: expected unqualified-id before 'if'
2 | if(S.at(i) == 'A'){
| ^~
a.cc:7:18: error: expected unqualified-id before 'else'
7 | }else if(S.at(i) == 'Z' && flag == true){
| ^~~~
a.cc:10:18: error: expected unqualified-id before 'else'
10 | }else if(S.at(i) != 'Z' && flag2 == true){
| ^~~~
a.cc:15:18: error: expected unqualified-id before 'else'
15 | }else if(flag == true){
| ^~~~
a.cc:18:9: error: expected declaration before '}' token
18 | }
| ^
a.cc:20:9: error: 'max_ans' does not name a type
20 | max_ans =max(max_ans , ans);
| ^~~~~~~
a.cc:21:9: error: 'cout' does not name a type
21 | cout << max_ans << endl;
| ^~~~
a.cc:22:2: error: expected unqualified-id before '/' token
22 | */
| ^
a.cc:25:1: error: expected declaration before '}' token
25 | }
| ^
|
s738894571 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string S;
cin >> S;
int min_x=S.size() , max_y = 0;
for(int i = 0; i < S.size(); i++){
if(S.at(i) == 'A'){
min_x = min(min_x, i);
}else if(S.at(i) == 'Z'){
max_y = (max_y, i);
}
}
if(max_y > min_x){
cout << max_y - min_x + 1 << endl;
}
}
/*
int ans = 0, max_ans = 0;
bool flag = false, flag2 = false;
for(int i = 0; i < S.size(); i++){
if(S.at(i) == 'A'){
flag = true;
ans++;
}else if(S.at(i) == 'Z' && flag == true){
ans++;
flag2 = true;
}else if(S.at(i) != 'Z' && flag2 == true){
flag = false;
flag2 = false;
max_ans = max(max_ans , ans);
ans = 0;
}else if(flag == true){
ans++;
}
}
max_ans =max(max_ans , ans);
cout << max_ans << endl;
*/
}
| a.cc:52:1: error: expected declaration before '}' token
52 | }
| ^
|
s113966812 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
#include <string>
int main() {
string S;
cin>>S;
int A,Z;
for(int i=0 ; i<S.size() ; i++){
if(S[i] =='A'){
A=i+1;
break;
}
}
string sue=std::reverse(S.begin(), S.end());
for(int i=0 ; i<sue.size() ; i++){
if(sue[i] =='Z'){
Z =S.size()-i;
break;
}
}
cout<<Z-A+1<<endl;
} | a.cc: In function 'int main()':
a.cc:15:26: error: conversion from 'void' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
15 | string sue=std::reverse(S.begin(), S.end());
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
|
s551673689 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin>>S;
int A,Z;
for(int i=0 ; i<S.size() ; i++){
if(S[i] =='A'){
A=i+1;
break;
}
}
string sue=std::reverse(S.begin(), S.end());
for(int i=0 ; i<sue.size() ; i++){
if(sue[i] =='Z'){
Z =S.size()-i;
break;
}
}
cout<<Z-A+1<<endl;
} | a.cc: In function 'int main()':
a.cc:14:26: error: conversion from 'void' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
14 | string sue=std::reverse(S.begin(), S.end());
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
|
s891421980 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin>>S;
int A,Z;
for(int i=0 ; i<S.size() ; i++){
if(S[i] =='A'){
A=i+1;
break;
}
}
string sue = reverse(S.begin(), S.end());
for(int i=0 ; i<sue.size() ; i++){
if(sue[i] =='Z'){
Z =S.size()-i;
break;
}
}
cout<<Z-A+1<<endl;
} | a.cc: In function 'int main()':
a.cc:14:24: error: conversion from 'void' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
14 | string sue = reverse(S.begin(), S.end());
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~
|
s352913329 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin>>S;
int A,Z;
for(int i=0 ; i<S.size() ; i++){
if(S[i] =='A'){
A=i+1;
break
}
}
string sue = reverse(S.begin(), S.end());
for(int i=0 ; i<sue.size() ; i++){
if(sue[i] =='Z'){
Z =N-i;
break
}
}
cout<<Z-A+1<<endl;
} | a.cc: In function 'int main()':
a.cc:11:12: error: expected ';' before '}' token
11 | break
| ^
| ;
12 | }
| ~
a.cc:14:24: error: conversion from 'void' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
14 | string sue = reverse(S.begin(), S.end());
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:17:10: error: 'N' was not declared in this scope
17 | Z =N-i;
| ^
a.cc:18:12: error: expected ';' before '}' token
18 | break
| ^
| ;
19 | }
| ~
|
s724744612 | p03814 | C++ | #include <iostream>
#include <string>
using namespace std;
int main() {
string s;
int ans;
cin >> s;
for (int i = 0; i < s.length(); i++) {
if (s[i] - 'A' == 0)break;
for(int j=s.length();j<=0;j--){
if (s[j] - 'Z' == 0) {
ans = j - i + 1;
break;
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:18:2: error: expected '}' at end of input
18 | }
| ^
a.cc:9:46: note: to match this '{'
9 | for (int i = 0; i < s.length(); i++) {
| ^
a.cc:18:2: error: expected '}' at end of input
18 | }
| ^
a.cc:5:12: note: to match this '{'
5 | int main() {
| ^
|
s490073447 | p03814 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
char c;
int i=1;
int l=100000;
int r=0;
while(cin>>c){
if(c=='A'&&i<l)l=i;
if(c=='Z'&&r<i)r=i;
I++;}
cout<<max(0,r-l+1)<<endl;
} | a.cc: In function 'int main()':
a.cc:12:1: error: 'I' was not declared in this scope
12 | I++;}
| ^
|
s129707274 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
int N=s.size();
int i,j
for(i=0;i<N;i++){
if(s[i]=='A'){
break;
}
}
for(j=N-1;j>=0;j--){
if(s[j]=='Z'){
break;
}
}
cout<<j-i+1<<endl;
} | a.cc: In function 'int main()':
a.cc:8:3: error: expected initializer before 'for'
8 | for(i=0;i<N;i++){
| ^~~
a.cc:8:18: error: expected ';' before ')' token
8 | for(i=0;i<N;i++){
| ^
| ;
a.cc:13:7: error: 'j' was not declared in this scope
13 | for(j=N-1;j>=0;j--){
| ^
a.cc:18:9: error: 'j' was not declared in this scope
18 | cout<<j-i+1<<endl;
| ^
|
s489686789 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
N=s.size();
for(int i=0;i<N;i++){
if(s[i]=='A'){
break;
}
}
for(int j=N-1;j>=0;j--){
if(s[j]=='Z'){
break;
}
}
cout<<j-i+1<<endl;
} | a.cc: In function 'int main()':
a.cc:6:3: error: 'N' was not declared in this scope
6 | N=s.size();
| ^
a.cc:17:9: error: 'j' was not declared in this scope
17 | cout<<j-i+1<<endl;
| ^
a.cc:17:11: error: 'i' was not declared in this scope
17 | cout<<j-i+1<<endl;
| ^
|
s392646023 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
for(int i=0;i<N;i++){
if(s[i]=='A'){
break;
}
}
for(int j=N-1;j>=0;j--){
if(s[j]=='Z'){
break;
}
}
cout<<j-i+1<<endl;
} | a.cc: In function 'int main()':
a.cc:6:17: error: 'N' was not declared in this scope
6 | for(int i=0;i<N;i++){
| ^
a.cc:11:13: error: 'N' was not declared in this scope
11 | for(int j=N-1;j>=0;j--){
| ^
a.cc:16:9: error: 'j' was not declared in this scope
16 | cout<<j-i+1<<endl;
| ^
a.cc:16:11: error: 'i' was not declared in this scope
16 | cout<<j-i+1<<endl;
| ^
|
s057909593 | p03814 | C++ | #include<bits/stdc++>
using namespace std;
int main(){
string s;
cin>>s;
for(int i=0;i<N;i++){
if(s[i]=='A'){
break;
}
}
for(int j=N-1;j>=0;j--){
if(s[j]=='Z'){
break;
}
}
cout<<j-i+1<<endl;
} | a.cc:1:9: fatal error: bits/stdc++: No such file or directory
1 | #include<bits/stdc++>
| ^~~~~~~~~~~~~
compilation terminated.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.