CHEFING FEB(19)

#include
#include <bits/stdc++.h>
using namespace std;
#define maxchar 26

/*int commoncharacters(string s[],int n)
{
bool prim[maxchar];
memset(prim,true,sizeof(prim));
for(int i=0;i<n;i++)
{
bool sec[maxchar];
memset(sec,false,sizeof(sec));
for(int j=0;s[i][j];j++)
{
if(prim[s[i][j]-‘a’])

         sec[s[i][j]-'a']=true;
    }
    memcpy(prim,sec,maxchar);
}
int count=0;
 for(int i=0;i<maxchar;i++)
        {
            if(prim[i])
                count++;
        }
return count;

}*/
const int MAX_CHAR = 26;

int commoncharacters(string str[], int n)
{
// primary array for common characters
// we assume all characters are seen before.
bool prim[MAX_CHAR];
memset(prim, true, sizeof(prim));

// for each string
for (int i = 0; i < n; i++) {

    // secondary array for common characters
    // Initially marked false
    bool sec[MAX_CHAR] = { false };

    // for every character of ith string
    for (int j = 0; str[i][j]; j++) {

        // if character is present in all
        // strings before, mark it.
        if (prim[str[i][j] - 'a'])
            sec[str[i][j] - 'a'] = true;
    }

    // copy whole secondary array into primary
    memcpy(prim, sec, MAX_CHAR);
}

int count=0;
 for(int i=0;i<maxchar;i++)
        {
            if(prim[i])
                count++;
        }
return count;

}

int main()
{
long int t,n;
cin>>t;
while(t–)
{
cin>>n;
string s[n];
for(int i=0;i<n;i++)
{
cin>>s[i];
}
int count=commoncharacters(s,n);
cout<<count<<"\n";
}
return 0;
}

why is it showing sigsecv i.e. runtime error?

@admin Can you please ban him for an attempt of cheating?

//