Comment if u find any improvement


#1

string s;
int n=A.size();
if(n==1)
return A[0];
int flag=1;
int i,j;
j=0;
while(flag)
{

    for( i=0;i<n-1;i++)
    {
        if(A[i][j]!=A[i+1][j])
        {
            flag=0;
            break;
            
        }
        else continue;
        
    }
    if(flag==1)
    s.push_back(A[i][j]);
    j++;
}
return s;

}