Submission #1685998


Source Code Expand

#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;
}

Submission Info

Submission Time
Task B - A to Z String
User tatt61880
Language C++14 (GCC 5.4.1)
Score 0
Code Size 311 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:13:30: error: expected primary-expression before ‘break’
   if(s[i] == 'A') start = i, break;
                              ^
./Main.cpp:7:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s", s);
                ^