A Game of Robots

/******************************************************************************

                          Online C++ Compiler.
           Code, Compile, Run and Debug C++ program online.

Write your code in this editor and press “Run” button to compile and execute it.

*******************************************************************************/

#include
#include

using namespace std;

int main()
{
int t,i,a[50],k=0,c[50],z;
string s;
cin>>t;
for(i=0;i<t;i++)
{ int n,count=0;
cin>>s;
n=s.length();
for(i=0;i<n;i++)
{ if(s[i]!=’.’)
c[k]=s[i];
a[k]=i;
k++;
}

  for(z=0;z<k;z++)
  { if((a[z+1]-a[z])>(c[k+1]+c[k]))
  cout<<"safe";
  else
  cout<<"unsafe";
  }
  // cout<<count;
   //cout<<n;

}}

error:- runtime error

working on concept
example- .1…2…
here- a[2]=1,6 (holding value of cell)
while - c[2]=1,2(holding value at cell)
if difference between cell number values greating than cell values sum makes bot safe as here.

can anyone help to solve this runtime error?