Attached code seems to be working fine but not accepted for A game of shadows-ROBOGAME!!

code
robots

#1

#include
#include
using namespace std;
int main()
{
int n,i,j,c,a1,a2;
cin>>n;
string s;
for(i=0;i<n;i++)
{ c=0;
cin>>s;
j=0;
while( s[j]==’.’)
j++;
while( s[j]!=’\0’)
{a1=s[j];
j++;
while( s[j]==’.’)
{j++; c++;}
a2=s[j];
if(c<a2+a1-96) {cout<<"unsafe
"; break;}
}
if(s[j]==’\0’) cout<<"safe
";
}
return 0;
}