criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  stirng S;
  cin >> S;
  int A, Z;
  for (int i = 0; i < S.length(); i++) {
    if (S[i] == 'A') {
      A = i;
      break;
    }
  }
  for (int i = S.length() - 1; i = < 0; i--) {
    if (S[i] == 'Z') {
      Z = i;
      break;
    }
  }
  cout << Z - A + 1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'stirng' was not declared in this scope
    5 |   stirng S;
      |   ^~~~~~
a.cc:6:10: error: 'S' was not declared in this scope
    6 |   cin >> S;
      |          ^
a.cc:14:36: error: expected primary-expression before '<' token
   14 |   for (int i = S.length() - 1; i = < 0; i--) {
      |                                    ^
Language: C++

#include <string>
#include <iostream>
using namespace std;



int main(){
    string s,s2;
    cin>>s;
    s2=s;
    reverse(s2.begin(), s2.end());
    
    int i=1;
    while (s[i]!='a') {
        i++;
    }
    
    int k=1;
    while (s2[k]!='z') {
        k++;
    }
    
    int ans=(int)s.length()-i-k;
    
    cout<<ans;
    
    return 0;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'reverse' was not declared in this scope
   11 |     reverse(s2.begin(), s2.end());
      |     ^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    string s;
    cin >>s;
    int a = 300000, z = -1;
    
    for(int i = 0; i < s.size; i++)
    {
        if(s[i]=='A') a=min(a,i);
        else if(s[i]=='Z') z = max(z,i);
    }
    cout << z-a<<endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:26: 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 '()' ?)
   21 |     for(int i = 0; i < s.size; i++)
      |                        ~~^~~~
      |                              ()
Language: C++

＃include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int a,z;
  int n=s.size();
  for(int i=0;i<n;i++){
    if(s.at(i)=='a'){a=i;}
    else if(s.at(i)=='z'){z=i;}}
  cout<<z-a+1<<endl;
  return 0;
}

Compiler output:
a.cc:1:1: error: '\U0000ff03include' does not name a type
    1 | ＃include<bits/stdc++.h>
      | ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:4:3: error: 'string' was not declared in this scope
    4 |   string s;
      |   ^~~~~~
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin>>s;
      |   ^~~
a.cc:5:8: error: 's' was not declared in this scope
    5 |   cin>>s;
      |        ^
a.cc:11:3: error: 'cout' was not declared in this scope
   11 |   cout<<z-a+1<<endl;
      |   ^~~~
a.cc:11:16: error: 'endl' was not declared in this scope
   11 |   cout<<z-a+1<<endl;
      |                ^~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  cin>>s;
  int l=s.size();
  int A=0,Z=0;
  for(int i=0;i<l;i++){
    if(s[i]=='A'){
      A=i;
      break;
    }
  }
  for(int i=l-1,i>=0;i--){
    if(s[i]=='Z'){
      Z=i;
      break;
    }
  }
  cout<<Z-A<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:18: error: expected ';' before '>=' token
   15 |   for(int i=l-1,i>=0;i--){
      |                  ^~
      |                  ;
a.cc:15:18: error: expected primary-expression before '>=' token
   15 |   for(int i=l-1,i>=0;i--){
      |                  ^~
Language: C++

#include <iostream>
using namespace std;

int main(){
  string s;
  cin >> s;
  int startNum = s.find("A");, endNum = s.rfind("Z");;
  cout << s.substr(startNum, endNum); << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:30: error: expected primary-expression before ',' token
    7 |   int startNum = s.find("A");, endNum = s.rfind("Z");;
      |                              ^
a.cc:7:32: error: 'endNum' was not declared in this scope; did you mean 'enum'?
    7 |   int startNum = s.find("A");, endNum = s.rfind("Z");;
      |                                ^~~~~~
      |                                enum
a.cc:8:39: error: expected primary-expression before '<<' token
    8 |   cout << s.substr(startNum, endNum); << endl;
      |                                       ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
    string s;
    cin >> s;
    cout << s.rfint('Z') - s.find('A') + 1 << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:15: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'rfint'; did you mean 'rfind'?
    7 |     cout << s.rfint('Z') - s.find('A') + 1 << endl;
      |               ^~~~~
      |               rfind
Language: C++

#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
double dat[100][100];
int dp[6][1010];//動的計画法
int prime[10000001];
char str[1010][1010];
vector<pair<int,int> > pc[100001];
int ABS(int a){return max(a,-a);}
int main(){
	string x;
	int s=0,e=0;
	cin>>x;
	for(int i=0;i<x.length();i++){
		if(x[i]=='A'){
			s=i;
			break;
		}
	}
	for(int i=s.length()-1;i>=0;i--){
		if(x[i]=='Z'){
			e=i;
			break;
		}
	}
	cout<<e-s+1<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:21: error: request for member 'length' in 's', which is of non-class type 'int'
   29 |         for(int i=s.length()-1;i>=0;i--){
      |                     ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  string s;
  cin>>s;
  
  int a=0;
  for(int i=0;i<s.size();++i){
    if(s[i]=='A'){
      a=i;
    }
    break;
  }
  
  int z=0;
  reverse(s.begin(),s.end())
  for(int i=0;i<s.size();++i){
    if(s[i]=='Z'){
      z=i;
    }
    break;
  }
  cout<<s.size()-a-z<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:29: error: expected ';' before 'for'
   20 |   reverse(s.begin(),s.end())
      |                             ^
      |                             ;
   21 |   for(int i=0;i<s.size();++i){
      |   ~~~                        
a.cc:21:15: error: 'i' was not declared in this scope
   21 |   for(int i=0;i<s.size();++i){
      |               ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  string s;
  cin>>s;
  
  int a=0;
  for(int i=0;i<s.size();++i){
    if(s[i]=='A')
      a=i;
      break;
  }
  
  int z=0;
  reverse(s.begin(),s.end())
  for(int i=0;i<s.size();++i){
    if(s[i]=='Z')
      z=i;
      break;
  }
  cout<<s.size()-a-z<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:29: error: expected ';' before 'for'
   19 |   reverse(s.begin(),s.end())
      |                             ^
      |                             ;
   20 |   for(int i=0;i<s.size();++i){
      |   ~~~                        
a.cc:20:15: error: 'i' was not declared in this scope
   20 |   for(int i=0;i<s.size();++i){
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int a;
int b;
int c = 0;

int main() {
  string str;
  cin >> str;
  for(int i = 0; i < (int)str.size(); ++i){
      char ch = str[i];
      if(ch == "A" && c == 0){
        a = i;
        c = 1;
      }
      if(ch == "Z" && c == 1){
        b = i;
      }
  }

cout << b - a + 1 << endl;  

}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 |       if(ch == "A" && c == 0){
      |          ~~~^~~~~~
a.cc:17:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 |       if(ch == "Z" && c == 1){
      |          ~~~^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int a;
int b;
boolean c;

int main() {
  string str;
  cin >> str;
  for(int i = 0; i < (int)str.size(); ++i){
      char ch = str[i];
      if(ch == "A" && c == false){
        a = i;
        c = true;
      }
      if(ch == "Z" && c == true){
        b = i;
      }
  }

cout << b - a + 1 << endl;  

}

Compiler output:
a.cc:6:1: error: 'boolean' does not name a type; did you mean 'bool'?
    6 | boolean c;
      | ^~~~~~~
      | bool
a.cc: In function 'int main()':
a.cc:13:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 |       if(ch == "A" && c == false){
      |          ~~~^~~~~~
a.cc:13:23: error: 'c' was not declared in this scope; did you mean 'ch'?
   13 |       if(ch == "A" && c == false){
      |                       ^
      |                       ch
a.cc:17:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 |       if(ch == "Z" && c == true){
      |          ~~~^~~~~~
a.cc:17:23: error: 'c' was not declared in this scope; did you mean 'ch'?
   17 |       if(ch == "Z" && c == true){
      |                       ^
      |                       ch
Language: C++

#include <iostream>
#include <stdio.h>
#include <sstream>
using namespace std;

int main() {
	string s;
	cin >> s;
	int sp = -1,ep = -1;
	for (int i = 0;i < s.size(),i++) {
		if (s[i] == 'A'&&sp == -1) sp = i;
		if (s[s.size()-i] == 'Z' && ep == -1) ep = i;
	}
	cout << ep - sp + 1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:40: error: expected ';' before ')' token
   10 |         for (int i = 0;i < s.size(),i++) {
      |                                        ^
      |                                        ;
Language: C++

#include <iostream>
#include <stdio.h>
#include <sstream>
using namespace std;

int main() {
	string s;
	cin >> s;]
	int sp = -1,ep = -1;
	for (int i = 0;i < s.size(),i++) {
		if (s[i] == 'A'&&sp == -1) sp = i;
		if (s[s.size()-i] == 'Z' && ep == -1) ep = i;
	}
	cout << ep - sp + 1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:18: error: expected primary-expression before ']' token
    8 |         cin >> s;]
      |                  ^
a.cc:10:40: error: expected ';' before ')' token
   10 |         for (int i = 0;i < s.size(),i++) {
      |                                        ^
      |                                        ;
a.cc:11:34: error: 'sp' was not declared in this scope; did you mean 's'?
   11 |                 if (s[i] == 'A'&&sp == -1) sp = i;
      |                                  ^~
      |                                  s
a.cc:12:45: error: 'ep' was not declared in this scope
   12 |                 if (s[s.size()-i] == 'Z' && ep == -1) ep = i;
      |                                             ^~
a.cc:14:17: error: 'ep' was not declared in this scope
   14 |         cout << ep - sp + 1 << endl;
      |                 ^~
a.cc:14:22: error: 'sp' was not declared in this scope; did you mean 's'?
   14 |         cout << ep - sp + 1 << endl;
      |                      ^~
      |                      s
Language: C++

#include<iostream>
#include<string>

using namespace std;


int main() {
	char s[200005];
	cin >> s;
	int len = strlen(s);

	int i;
	for (i = 0; i < len; i++) {
		if (s[i] == 'A')
			break;
	}


	int j;
	for (j = len - 1; j > i; j--) {
		if (s[j] == 'Z')
			break;
	}

	cout << j - i + 1<< endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:19: error: 'strlen' was not declared in this scope
   10 |         int len = strlen(s);
      |                   ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #include<string>
Language: C++

#include <bits/stdc++.n>
using namespace std;
int main ()
{
    int l,r;
    string s;
    cin>>s;
    for (int i = 0;i<s.size();i++) {
        if (s[i]=='A') {
            l==i;
            break;
        }
    }
    for (int i = 0; i < s.size(); ++i)
    {
        if (s[i]=='Z') r=i;
    }
    cout<<r-l+1<<endl;
}

Compiler output:
a.cc:1:10: fatal error: bits/stdc++.n: No such file or directory
    1 | #include <bits/stdc++.n>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.n>
using namespace std;
int main ()
{
    int l,r;
    string s;
    cin>>s;
    for (int i = 0;i<s.size();i++) {
        if (s[i]=='A') {
            i==i;
            break;
        }
    }
    for (int i = 0; i < s.size(); ++i)
    {
        if (s[i]=='Z') r=i;
    }
    cout<<r-l+1<<endl;
}

Compiler output:
a.cc:1:10: fatal error: bits/stdc++.n: No such file or directory
    1 | #include <bits/stdc++.n>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int Digits(llong num){
  int cnt = 0;
  while(num > 0){
    num / 10;
    cnt++;
  }
  return cnt;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    int len = S.size();
    int A_i,Z_i;
    for(int i = 0; i < len; ++i){
      if(S[i] == 'A') break;
    }
    A_i = i;
    for(int i = len -1; i > 0;i--){
      if(S[i] == 'Z') break;
    }
    Z_i = i;
  
    cout << Z_i - A_i + 1 << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:11: error: 'i' was not declared in this scope
   39 |     A_i = i;
      |           ^
Language: C++

#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
typedef pair<string, string> pss;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

char buf[200005];

int main() {
  scanf("%s", buf);
  int a = 0;
  while(buf[a] != 'A') a++;
  int b = strlen(buf);
  while(buf[b-1] != 'Z') b--;
  printf("%d\n", b-a;)
}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:21: error: expected ')' before ';' token
   51 |   printf("%d\n", b-a;)
      |         ~           ^
      |                     )
a.cc:51:22: error: expected primary-expression before ')' token
   51 |   printf("%d\n", b-a;)
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  string s;
  cin>>s;
  int A,Z;
  int i=0;
  int Flag=0;
  int L=s.size();

  for(int i=0;i<L;i++){
    if(s[i]=='A' && Flag=0){
      A=i;
      Flag=1;
    }
    if(s[i]=='Z')Z=i;
  }
  cout<<(Z-A)+1<<endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:18: error: lvalue required as left operand of assignment
   13 |     if(s[i]=='A' && Flag=0){
Language: C++

#include<iostream>
#include<string>
using namespace std;

int main(int argc, char const *argv[])
{ 
    string s;
    int f,l;
    cin>>s;
    for(int i=0;i<s.length();i++){
        if(s[i]=='A'){
            f=i;
            break;
        }
    }
    for(int i=s.length-1;i>=0;i--){
        if(s[i]=='Z'){
            l=i;
            break;
        }
    }
    cout<<l-f+1;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:16:17: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   16 |     for(int i=s.length-1;i>=0;i--){
      |               ~~^~~~~~
      |                       ()
Language: Java

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		int count = 0;
		int flag = 0;
		ArrayList<Integer> array = new ArrayList<Integer>();
		String[] param = a.split("");
		for (int i = 0; i < a.length(); i++) {
			if (param[i].equals("A")) {
				flag = i;
				break;
			}
		}

		for (int j = flag; j < a.length(); j++) {
			count++;
			if (param[j].equals("Z")) {
				array.add(count);
			}
		}
		Collections.sort(array);
		Collections.reverse(array);
		System.out.println(array.get(0));
	}
}

Compiler output:
Main.java:5: error: class main is public, should be declared in a file named main.java
public class main {
       ^
1 error
Language: C++

#include<stdio.h>
int main(){
char a[200000];
int i=0,cnt=0,start=0,e=0,sum=0;
scanf("%s",&a);
while(a[i]!=0){
cnt+=1;
i++;
}
for(i=cnt;i>0;i--){
if(a[i]=='Z'){
e=i;
break;
}
for(i=0;i<200000;i++){
if(a[i]=='A'){
start=i;
break;
}
}
sum=(e-start)+1;
printf("%d",sum);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:2: error: expected '}' at end of input
   23 | }
      |  ^
a.cc:2:11: note: to match this '{'
    2 | int main(){
      |           ^
Language: C++

＃include <stdio.h>
int main(void){
char a[200000];
int i=0,cnt=0,start=0,e=0,sum=0;
scanf("%s",&a);
while(a[i]!=0){
cnt+=1;
i++;
}
for(i=cnt;i>0;i--){
if(a[i]=='Z'){
e=cnt;
break;
}
for(i=0;i<200000;i++){
if(a[i]=='A'){
start=i;
break;
}
}
sum=(e-start)+1;
printf("%d",sum);
}

Compiler output:
a.cc:1:1: error: '\U0000ff03include' does not name a type
    1 | ＃include <stdio.h>
      | ^~~~~~~~~
Language: C++

＃include <stdio.h>
int main(void){
char a[200000];
int i=0,cnt=0,start=0,end=0,sum=0;
scanf("%s",&a);
while(a[i]!=0){
cnt+=1;
i++;
}
for(i=cnt;i>0;i--){
if(a[i]=='Z'){
end=cnt;
break;
}
for(i=0;i<200000;i++){
if(a[i]=='A'){
start=i;
break;
}
}
sum=(end-start)+1;
printf("%d",sum);
}

Compiler output:
a.cc:1:1: error: '\U0000ff03include' does not name a type
    1 | ＃include <stdio.h>
      | ^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    string S;
    cin >> S;
    int l,r;
    rep(i,0,S){
        if(S[i] == 'A'){
            l = i;
            break;
        }
    }
    for(int i = S.size()-1;i >= 0;i--){
        if(S[i] == 'Z'){
            r = i;
            break;
        }
    }
    cout << r - l + 1 << endl;
}

Compiler output:
a.cc:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:2:39: error: invalid cast from type 'std::string' {aka 'std::__cxx11::basic_string<char>'} to type 'int'
    2 | #define rep(i,a,b) for(int i=int(a);i<int(b);++i)
      |                                       ^~~~~~
a.cc:11:5: note: in expansion of macro 'rep'
   11 |     rep(i,0,S){
      |     ^~~
Language: C++

#include <iostream>
#include <string>


using namespace std;
int main()
{
	string s;
	int len = 0;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'A') {
			for (int j = i; j < s.size(); j++) {
				if (s[j] == 'Z') {
					len = j - i + 1;
				}
			}
			break;
		}
	}

	cout << len << endl;
	cout << t << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: 't' was not declared in this scope
   23 |         cout << t << endl;
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  string a;
  cin>>a;
  int n=a.size();
  int b;
  int c;
  for(int i=0;i<n;i++){
    if(a[i]="A"){
      b=i;
      break;
      }
    }
  for(int i=0;i<n;i++){
    if(a[i]="Z"){
      c=i;
      break;
      }
    }
  cout<<c-b+1<<endl;
  return 0;
}
           

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   10 |     if(a[i]="A"){
      |             ^~~
      |             |
      |             const char*
a.cc:16:13: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   16 |     if(a[i]="Z"){
      |             ^~~
      |             |
      |             const char*
Language: C++

#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<string>
using namespace std;
string S;
cin>>S;
int x,y;
for (int i=0; i < S.size(); i++){
if(S[i]=='A')
x = i;
break;
}
for (int i=0; i < S.size(); i++){
if(S[i]=='Z')
y = i;
break;
}
cout<<y-x+1<<endl;
}


Compiler output:
a.cc:9:1: error: 'cin' does not name a type
    9 | cin>>S;
      | ^~~
a.cc:11:1: error: expected unqualified-id before 'for'
   11 | for (int i=0; i < S.size(); i++){
      | ^~~
a.cc:11:15: error: 'i' does not name a type
   11 | for (int i=0; i < S.size(); i++){
      |               ^
a.cc:11:29: error: 'i' does not name a type
   11 | for (int i=0; i < S.size(); i++){
      |                             ^
a.cc:16:1: error: expected unqualified-id before 'for'
   16 | for (int i=0; i < S.size(); i++){
      | ^~~
a.cc:16:15: error: 'i' does not name a type
   16 | for (int i=0; i < S.size(); i++){
      |               ^
a.cc:16:29: error: 'i' does not name a type
   16 | for (int i=0; i < S.size(); i++){
      |                             ^
a.cc:21:1: error: 'cout' does not name a type
   21 | cout<<y-x+1<<endl;
      | ^~~~
a.cc:22:1: error: expected declaration before '}' token
   22 | }
      | ^
Language: C++

#include <iostream>
#include <stdio.h>
#include <string.h>
#include<cstring>

using namespace std;


int main(){
  string t;
  cin >> t;
  char* s = new char[t.size() +1 ];
  std::char_traits<char>::copy(s, t.c_str(), t.size()+1);
  
  int z = 'Z';
  int ans;
  ans = strrchr(*s,'Z') - strchr(*s,'A') + 1;
  cout << ans <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:16: error: no matching function for call to 'strrchr(char&, char)'
   17 |   ans = strrchr(*s,'Z') - strchr(*s,'A') + 1;
      |         ~~~~~~~^~~~~~~~
In file included from a.cc:3:
/usr/include/string.h:253:14: note: candidate: 'char* strrchr(char*, int)' (near match)
  253 | extern char *strrchr (char *__s, int __c)
      |              ^~~~~~~
/usr/include/string.h:253:14: note:   conversion of argument 1 would be ill-formed:
a.cc:17:17: error: invalid conversion from 'char' to 'char*' [-fpermissive]
   17 |   ans = strrchr(*s,'Z') - strchr(*s,'A') + 1;
      |                 ^~
      |                 |
      |                 char
/usr/include/string.h:255:20: note: candidate: 'const char* strrchr(const char*, int)' (near match)
  255 | extern const char *strrchr (const char *__s, int __c)
      |                    ^~~~~~~
/usr/include/string.h:255:20: note:   conversion of argument 1 would be ill-formed:
a.cc:17:17: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   17 |   ans = strrchr(*s,'Z') - strchr(*s,'A') + 1;
      |                 ^~
      |                 |
      |                 char
a.cc:17:33: error: no matching function for call to 'strchr(char&, char)'
   17 |   ans = strrchr(*s,'Z') - strchr(*s,'A') + 1;
      |                           ~~~~~~^~~~~~~~
/usr/include/string.h:226:14: note: candidate: 'char* strchr(char*, int)' (near match)
  226 | extern char *strchr (char *__s, int __c)
      |              ^~~~~~
/usr/include/string.h:226:14: note:   conversion of argument 1 would be ill-formed:
a.cc:17:34: error: invalid conversion from 'char' to 'char*' [-fpermissive]
   17 |   ans = strrchr(*s,'Z') - strchr(*s,'A') + 1;
      |                                  ^~
      |                                  |
      |                                  char
/usr/include/string.h:228:20: note: candidate: 'const char* strchr(const char*, int)' (near match)
  228 | extern const char *strchr (const char *__s, int __c)
      |                    ^~~~~~
/usr/include/string.h:228:20: note:   conversion of argument 1 would be ill-formed:
a.cc:17:34: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   17 |   ans = strrchr(*s,'Z') - strchr(*s,'A') + 1;
      |                                  ^~
      |                                  |
      |                                  char
Language: C++

#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;


int main(){
  string s;
  cin >> s;
  int z = 'Z';
  int ans;
  ans = strrchr(*s,'Z') - strchr(*s,'A') + 1;
  cout << ans <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: no match for 'operator*' (operand type is 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   13 |   ans = strrchr(*s,'Z') - strchr(*s,'A') + 1;
      |                 ^~
a.cc:13:34: error: no match for 'operator*' (operand type is 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   13 |   ans = strrchr(*s,'Z') - strchr(*s,'A') + 1;
      |                                  ^~
Language: C++

#include<iostream>
#include <stdio.h>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <map>
#define MOD 1000000007
using namespace std;
typedef long long ll;
 
int main(){
 
string s;
int A=-1,Z;
for(int i = 0; i < s.size() && A=-1; i++){
  if(s[i] == 'A') A = i;
}

for(int i = A+1; i < s.size(); i++){
  if(s[i] == 'Z') Z = i;
}
  
  cout << Z - A + 1<< endl;
  
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:29: error: lvalue required as left operand of assignment
   17 | for(int i = 0; i < s.size() && A=-1; i++){
      |                ~~~~~~~~~~~~~^~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
	int a, b, c;
	string s;
	cin >> s;
	a = s.find("A");
	b = rfind("Z");
	cout << a - b << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: 'rfind' was not declared in this scope; did you mean 'rewind'?
    9 |         b = rfind("Z");
      |             ^~~~~
      |             rewind
Language: C++

#include <iostream>
using namespace std;

int main() {
	int a, b, c;
	string s;
	cin >> s;
	a = s.find("A");
	b = rfind("Z")
	cout << a - b << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: 'rfind' was not declared in this scope; did you mean 'rewind'?
    9 |         b = rfind("Z")
      |             ^~~~~
      |             rewind
Language: C++

#include <string>
using namespace std;
int main() {
    int a, z, c = 0;
    string s;
    cin >> s;
    int S = s.size();
    for (int i = 0; i < S; i++) {
        if (s[i] == 'A' && c == 0) {
            a = i;
            c++;
        }
        if (s[i] == 'Z') {
                z = i;
        }
    }
    int A = a+1, Z = z+1;
    cout << Z - A + 1 << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin >> s;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <string>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:18:5: error: 'cout' was not declared in this scope
   18 |     cout << Z - A + 1 << endl;
      |     ^~~~
a.cc:18:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:26: error: 'endl' was not declared in this scope
   18 |     cout << Z - A + 1 << endl;
      |                          ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <string>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include <bits/stdc++.h>
#define INF (1<<30)
#define INFLL (1ll<<60)
#define EPS (1e-10)
using namespace std;
map <int,int> mp;
typedef pair<int, int> P;
typedef long long ll;
static const int MAX=100000;
static const int NMAX=100;

int main(){
    string s; cin>>s;
    int s1=-1,s2=-1;

    for(int i=0;i<s.size();i++){
        if(s[i] =='A'&&s1==-1)s1=i;
        if(s[i]=='Z')s2=i;
        cout<<s1<<" "<<s2<<"\n";
    }

    cout<<s2-s1+1<<"\n";
    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:23:14: error: expected '}' at end of input
   23 |     return 0;
      |              ^
a.cc:12:11: note: to match this '{'
   12 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll cnt,x[1000],y[1000];
double maxn=-99999;
inline double dist(ll ind1,ll ind2)
{
	int xx=x[ind1]-x[ind2],yy=y[ind1]-y[ind2];
	return sqrt(xx*xx+yy*yy);
}
int main()
{
	cin>>cnt;
	for(register int i=0;i<cnt;i++)
	{
		cin>>x[i]>>y[i];
	}
	for(register int i=0;i<cnt-1;i++)
	{
		for(register int j=i+1;j<cnt;j++)
		{
			maxn=max(maxn,dist(i,j));
		}
	}
	printf("%.12lf\n \",maxn);
}


Compiler output:
a.cc:25:16: warning: missing terminating " character
   25 |         printf("%.12lf\n \",maxn);
      |                ^
a.cc:25:16: error: missing terminating " character
   25 |         printf("%.12lf\n \",maxn);
      |                ^~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:14:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   14 |         for(register int i=0;i<cnt;i++)
      |                          ^
a.cc:18:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   18 |         for(register int i=0;i<cnt-1;i++)
      |                          ^
a.cc:20:34: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |                 for(register int j=i+1;j<cnt;j++)
      |                                  ^
a.cc:26:1: error: expected primary-expression before '}' token
   26 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main() {
  string s;
  cin>>s;
  for(int i=0;s[i]!='A';i++);
  for(int j=s.size();s[j]!='Z';j--);
  cout<<j-i+1;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'j' was not declared in this scope
    9 |   cout<<j-i+1;
      |         ^
a.cc:9:11: error: 'i' was not declared in this scope
    9 |   cout<<j-i+1;
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main() {
  int i, j;
  cin>>s;
  for(i=0;s[i]!='A';i++){
    for(j=s.size();s[j]!='Z';j--){
      cout<<j-i+1;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:8: error: 's' was not declared in this scope
    6 |   cin>>s;
      |        ^
Language: Java

import java.util.*;
import java.util.HashSet;
import java.util.Set;
public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        int a=0;
        int z=0;
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=="A"){
                a=i;
            }
            if(s.charAt(i)=="Z"){
                z=i;
            }
        }
        System.out.println(z-a);



        }
       
        
    }


Compiler output:
Main.java:11: error: bad operand types for binary operator '=='
            if(s.charAt(i)=="A"){
                          ^
  first type:  char
  second type: String
Main.java:14: error: bad operand types for binary operator '=='
            if(s.charAt(i)=="Z"){
                          ^
  first type:  char
  second type: String
2 errors
Language: C++

#include <algorithm>
#include <iostream>
using namespace std;

int main(){
	string s;
	cin >> s;
	int i=0, j=0; a=2;
	for(i=0; i<s.size(); i++){
		if(s[i]=='A'){
			for(j=i+1; j<s.size(); j++){
				if(s[j]=='Z'){
					a = max(a,j-i+1);
				}
			}
		}
	}
	cout << a;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:23: error: 'a' was not declared in this scope
    8 |         int i=0, j=0; a=2;
      |                       ^
Language: C++

#include<iostream>
#include<vector>
#include<queue>
#include<string>
using namespace std;
int main(void){
string s;
cin>>s;
int a,b;
bool f=true;
for(int i=0;i<s.size();i++){
	if(s[i]=='A'&&f){
		a=i;
		f=false;
	}
	if(s[i]=='Z'){
		b=i;
	}
}
cout<<b-a+1<<endl;
	return 0;
}#include<iostream>
#include<vector>
#include<queue>
#include<string>
using namespace std;
int main(void){
string s;
cin>>s;
int a,b;
bool f=true;
for(int i=0;i<s.size();i++){
	if(s[i]=='A'&&f){
		a=i;
		f=false;
	}
	if(s[i]=='Z'){
		b=i;
	}
}
cout<<b-a+1<<endl;
	return 0;
}#include<iostream>
#include<vector>
#include<queue>
#include<string>
using namespace std;
int main(void){
string s;
cin>>s;
int a,b;
bool f=true;
for(int i=0;i<s.size();i++){
	if(s[i]=='A'&&f){
		a=i;
		f=false;
	}
	if(s[i]=='Z'){
		b=i;
	}
}
cout<<b-a+1<<endl;
	return 0;
}

Compiler output:
a.cc:22:2: error: stray '#' in program
   22 | }#include<iostream>
      |  ^
a.cc:43:2: error: stray '#' in program
   43 | }#include<iostream>
      |  ^
a.cc:22:3: error: 'include' does not name a type
   22 | }#include<iostream>
      |   ^~~~~~~
a.cc:27:5: error: redefinition of 'int main()'
   27 | int main(void){
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main(void){
      |     ^~~~
a.cc:43:3: error: 'include' does not name a type
   43 | }#include<iostream>
      |   ^~~~~~~
a.cc:48:5: error: redefinition of 'int main()'
   48 | int main(void){
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main(void){
      |     ^~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<ll, int> P;
#define MOD (1000000007ll)
#define l_ength size

ll sq(ll x){
	return x*x;
}

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

bool isvowel(char c){
	int i;
	string v="aeiou";
	for(i = (v.size()-1); i>=0; --i){
		if(c == v[i]){
			return true;
		}
	}
	return false;
}

int main(void){
	int s,l,r;
	string s;
	l = 0;
	r = s.length()-1;
	while(s[l]!='A'){
		++l;
	}
	while(s[r]!='Z'){
		--r;
	}
	cout << (r-l+1) << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:16: error: conflicting declaration 'std::string s'
   32 |         string s;
      |                ^
a.cc:31:13: note: previous declaration as 'int s'
   31 |         int s,l,r;
      |             ^
a.cc:34:15: error: request for member 'length' in 's', which is of non-class type 'int'
   34 |         r = s.length()-1;
      |               ^~~~~~
a.cc:35:16: error: invalid types 'int[int]' for array subscript
   35 |         while(s[l]!='A'){
      |                ^
a.cc:38:16: error: invalid types 'int[int]' for array subscript
   38 |         while(s[r]!='Z'){
      |                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)

int main(void){
    string s;
    cin>>s;
    int n = s.size();
    int l,r;
    rep(i,n){
        if(s[i]=='A') l=i,break;
    }
    rep(i,n){
        if(s[i]=='Z') r=i;
    }
    cout<<r-l+1<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:27: error: expected primary-expression before 'break'
   11 |         if(s[i]=='A') l=i,break;
      |                           ^~~~~
Language: C++

#include <bits/stdc++.h>
#define INF 114514810
using namespace std;

int main(void){
    string s;
    int a = INF, z = -1;
    cin >> s;
    if (int i = 0; i < s.size(); i++) {
        if (s[i] == 'A') a = min(a, i);
        if (s[i] == 'Z') z = max(z, i);
    }
    cout << z - a + 1 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:32: error: expected ')' before ';' token
    9 |     if (int i = 0; i < s.size(); i++) {
      |        ~                       ^
      |                                )
a.cc:9:34: error: 'i' was not declared in this scope
    9 |     if (int i = 0; i < s.size(); i++) {
      |                                  ^
Language: C++


s = input()

while True:
    if s[0] != 'A':
        s = s[1:]
        continue
    if s[-1] != 'Z':
        s = s[:-1]
        continue
    break

print(len(s))



Compiler output:
a.cc:2:1: error: 's' does not name a type
    2 | s = input()
      | ^
Language: C++

int main(void) {

	std::string s;
	int A = 0, Z = 0, X = 0;
	std::cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'A') {
			A = i + 1;
			break;
		}
	}
	for (int j = s.size() - 1; j > 0; j--) {
		if (s[j] == 'Z') {
			Z = j + 1;
			break;
		}
	}
	X = Z - A + 1;
	std::cout << X << std::endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:14: error: 'string' is not a member of 'std'
    3 |         std::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 | int main(void) {
a.cc:5:14: error: 'cin' is not a member of 'std'
    5 |         std::cin >> s;
      |              ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | int main(void) {
a.cc:5:21: error: 's' was not declared in this scope
    5 |         std::cin >> s;
      |                     ^
a.cc:19:14: error: 'cout' is not a member of 'std'
   19 |         std::cout << X << std::endl;
      |              ^~~~
a.cc:19:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:32: error: 'endl' is not a member of 'std'
   19 |         std::cout << X << std::endl;
      |                                ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | int main(void) {
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

#define int long long


int main() {
    string s;
    cin >> s;
    cout << (s.rfind('Z') - s.find('A') + 1) << endl;
    return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<bits/stdc++.h>

int N,K;
char S[200020] = {0};
int a,b;

int main()
{
    scanf("%s",S);
    N = strlen(S);
    for(int i = 0; i < N; i++)if(S[i] == 'Z')a = i;
    reverse(S,S + N);
    for(int i = 0; i < N; i++)if(S[i] == 'A')b = i;
    printf("%d\n",a + b - N + 2);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'reverse' was not declared in this scope; did you mean 'std::reverse'?
   12 |     reverse(S,S + N);
      |     ^~~~~~~
      |     std::reverse
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: 'std::reverse' declared here
  249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
      | ^~~~~~~
Language: C++

#include<stdio.h>
#include<string.h>
#include<bits/stdc++.h>

int N,K;
char S[200020] = {0};
int a,b;

int main()
{
    scanf("%s",S);
    N = strlen(S);
    for(int i = 0; i < N; i++)if(S[i] == 'Z')a = i;
    reverse(S,S + N);
    for(int i = 0; i < N; i++)if(S[i] == 'A')b = i;
    printf("%d\n",a + b - N + 2);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'reverse' was not declared in this scope; did you mean 'std::reverse'?
   14 |     reverse(S,S + N);
      |     ^~~~~~~
      |     std::reverse
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: 'std::reverse' declared here
  249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
      | ^~~~~~~
Language: C++

#include<stdio.h>
#include<string.h>
#include<algorithm>

int N,K;
char S[200020] = {0};
int a,b;

int main()
{
    scanf("%s",S);
    N = strlen(S);
    for(int i = 0; i < N; i++)if(S[i] == 'Z')a = i;
    reverse(S,S + N);
    for(int i = 0; i < N; i++)if(S[i] == 'A')b = i;
    printf("%d\n",a + b - N + 2);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'reverse' was not declared in this scope; did you mean 'std::reverse'?
   14 |     reverse(S,S + N);
      |     ^~~~~~~
      |     std::reverse
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: 'std::reverse' declared here
  249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
      | ^~~~~~~
Language: C++

#include <cstdio>
#include <cstring>

int main(void)
{
 char s[200001];
 scanf("%s", s);
 int start, end;
 for(int i = 0; i < strlen(s); i++){
  if(s[i] == 'Z') end = i;
 }
 for(int i = 0; i < strlen(s); i++){
  if(s[i] == 'A') start = i, break;
 }
 printf("%d\n", end - start + 1);
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:30: error: expected primary-expression before 'break'
   13 |   if(s[i] == 'A') start = i, break;
      |                              ^~~~~
Language: Java

import java.util.*;
import java.io.*;
//A to Z String
public class Main{

public static void main(String[] args){
  Scanner inp = new Scanner(System.in);
  String u = input.nextLine();
  int aPos = -1;
  int zPos = u.length();
  for(int i = u.length() - 1; i > 0; i--){
    String chr = u.substring(i - 1,i);
    if(chr.equals("A"))
      aPos = i;
     
  }
  for(int j = aPos; j < u.length() - 1; j++){
    String chr2 = u.substring(j,j+ 1);
    if(chr2.equals("Z"))
      zPos = j;
  }
  System.out.println(zPos - aPos + 1); 
}
}


Compiler output:
Main.java:8: error: cannot find symbol
  String u = input.nextLine();
             ^
  symbol:   variable input
  location: class Main
1 error
Language: Java

import java.util.*;
public class Main{

public static void main(String[] args){
  Scanner inp = new Scanner(System.in);
  String u = input.nextLine();
  int aPos = -1;
  int zPos = u.length();
  for(int i = u.length() - 1; i > 0; i--){
    String chr = u.substring(i - 1,i);
    if(chr.equals("A"))
      aPos = i;
     
  }
 public class Main{

public static void main(String[] args){
  Scanner inp = new Scanner(System.in);
  String u = input.nextLine();
  int aPos = -1;
  int zPos = u.length();
  for(int i = u.length() - 1; i > 0; i--){
    String chr = u.substring(i - 1,i);
    if(chr.equals("A"))
      aPos = i;
     
  }
  for(int j = aPos; j < u.length() - 1; j++){
    String chr2 = u.substring(j,j+ 1);
    if(chr2.equals("Z"))
      zPos = j;
  }
  System.out.println(zPos - aPos + 1); 
}
}
 for(int j = aPos; j < u.length() - 1; j++){
    String chr2 = u.substring(j,j+ 1);
    if(chr2.equals("Z"))
      zPos = j;
  }
  System.out.println(zPos - aPos + 1); 
}
}


Compiler output:
Main.java:15: error: illegal start of expression
 public class Main{
 ^
Main.java:36: error: illegal start of type
 for(int j = aPos; j < u.length() - 1; j++){
 ^
Main.java:36: error: > or ',' expected
 for(int j = aPos; j < u.length() - 1; j++){
                               ^
Main.java:36: error: ';' expected
 for(int j = aPos; j < u.length() - 1; j++){
                                 ^
Main.java:36: error: <identifier> expected
 for(int j = aPos; j < u.length() - 1; j++){
                                        ^
Main.java:41: error: <identifier> expected
  System.out.println(zPos - aPos + 1); 
                    ^
Main.java:41: error: <identifier> expected
  System.out.println(zPos - aPos + 1); 
                         ^
Main.java:43: error: class, interface, enum, or record expected
}
^
8 errors
Language: Java

import java.util.*;
public class Main{

public static void main(String[] args){
  Scanner inp = new Scanner(System.in);
  String u = input.next();
  int aPos = -1;
  int zPos = u.length();
  for(int i = u.length() - 1; i > 0; i--){
    String chr = u.substring(i - 1,i);
    if(chr.equals("A"))
      aPos = i;
     
  }
  for(int j = aPos; j < u.length() - 1; j++){
    String chr2 = u.substring(j,j+ 1);
    if(chr2.equals("Z"))
      zPos = j;
  }
  System.out.println(zPos - aPos + 1); 
}
}


Compiler output:
Main.java:6: error: cannot find symbol
  String u = input.next();
             ^
  symbol:   variable input
  location: class Main
1 error
Language: Java

import java.util.*;
public class Main{

public static void main(String[] args){
  Scanner inp = new Scanner(System.in);
  String u = input.nextln();
  int aPos = -1;
  int zPos = u.length();
  for(int i = u.length() - 1; i > 0; i--){
    String chr = u.substring(i - 1,i);
    if(chr.equals("A"))
      aPos = i;
     
  }
  for(int j = aPos; j < u.length() - 1; j++){
    String chr2 = u.substring(j,j+ 1);
    if(chr2.equals("Z"))
      zPos = j;
  }
  System.out.println(zPos - aPos + 1); 
}
}



Compiler output:
Main.java:6: error: cannot find symbol
  String u = input.nextln();
             ^
  symbol:   variable input
  location: class Main
1 error
Language: Java

import java.util.*;
public class Main{

public static void main(String[] args){
  Scanner inp = new Scanner(System.in);
  String u = input.nextln();
  int aPos = -1;
  int zPos = u.length();
  for(int i = u.length() - 1; i > 0; i--){
    String chr = u.substring(i - 1,i);
    if(chr.equals("A"))
      aPos = i;
     
  }public class Main{

public static void main(String[] args){
  Scanner inp = new Scanner(System.in);
  String u = input.nextln();
  int aPos = -1;
  int zPos = u.length();
  for(int i = u.length() - 1; i > 0; i--){
    String chr = u.substring(i - 1,i);
    if(chr.equals("A"))
      aPos = i;
     
  }
  for(int j = aPos; j < u.length() - 1; j++){
    String chr2 = u.substring(j,j+ 1);
    if(chr2.equals("Z"))
      zPos = j;
  }
  System.out.println(zPos - aPos + 1); 
}
}

  for(int j = aPos; j < u.length() - 1; j++){
    String chr2 = u.substring(j,j+ 1);
    if(chr2.equals("Z"))
      zPos = j;
  }
  System.out.println(zPos - aPos + 1); 
}
}


Compiler output:
Main.java:14: error: illegal start of expression
  }public class Main{
   ^
Main.java:36: error: illegal start of type
  for(int j = aPos; j < u.length() - 1; j++){
  ^
Main.java:36: error: > or ',' expected
  for(int j = aPos; j < u.length() - 1; j++){
                                ^
Main.java:36: error: ';' expected
  for(int j = aPos; j < u.length() - 1; j++){
                                  ^
Main.java:36: error: <identifier> expected
  for(int j = aPos; j < u.length() - 1; j++){
                                         ^
Main.java:41: error: <identifier> expected
  System.out.println(zPos - aPos + 1); 
                    ^
Main.java:41: error: <identifier> expected
  System.out.println(zPos - aPos + 1); 
                         ^
Main.java:43: error: class, interface, enum, or record expected
}
^
8 errors