Spoj GUESSTHE WA

Why it is giving WA in GUESSTHE … Can you give me test cases in which it will fail…
#include
#include
#include <string.h>

int main()
{
char str[21];
int i;
int j;
int l;
long long int no = 1;

scanf(“%s”, str);

while (strcmp (str , “*”))
{
l = strlen(str);

for (i = l-1 ; i >= 0 ; --i){
if (str[i] == ‘Y’){
if (no % (i+1) != 0){
no = no *(i+1);
}
}
}

for (j = 0 ; j < l ; ++j){
if (str[j] == ‘N’){
if (no % (j+1) == 0){
no = -1;
break;
}
}

}
printf(“%lld\n”, no);
scanf(“%s”, str);
no = 1;
}
return 0;
}

Question link :-- SPOJ.com - Problem GUESSTHE
Thnx in advance…!!!

@asvcracker007 try this case: YYYYNY. Answer should be 12 but yours is 24.

1 Like