I just want to know why it come the question that string subscript out of range,I have already initialized the string array.Thank you.
#include<bits/stdc++.h>
#define N 100000
using namespace std;
string s[N + 5] = {}, ss[N + 5] = { " " }, fs[N + 5] = { " " };
int main()
{
int n, x; char c;
cin >> n;
for (int i = 0; i<n; ++i)
{
for (int j = 0; j<6; ++j)
{
scanf("%c", &c);//the error comes here.
if (c == ' ') continue;
s[i] += c;
}
ss[i] = s[i] + s[i];
for (int j = 5; j >= 0; --j) fs[i][j] = s[i][5 - j];
}
int flag = 0;
for (int i = 0; i<n; ++i)
{
for (int j = 0; j<n; ++j)
{
if (i == j) continue;
if (find(s[i], fs[j]) || find(s[i], ss[j]))
{
flag = 1; break;
}
}
}
}