in the loop for the first time before giving any input it autometically prints INVALID then it works corrctly where is the fault cann't understand help please....
What I have tried:
#include <iostream>
#include
using namespace std;
int main()
{
int n;
while(cin>>n)
{
for(int i=0;i<n;i++)>
{
string s;
getline(cin,s);
int len=s.size(),flag=0;
for(int i=1;i<100;i++)
{
int x=pow(i,2);
if(x==len)
{
flag=1;
break;
}
}
int len2=pow(len,.5);
if(flag==0)
cout<<"INVALID\n";
else
{
int p=0;
char c [len2][len2];
for(int i=0;i<len2;i++)>
{
for(int j=0;j<len2;j++)>
{
c[i][j]=s[p];
p++;
}
}
for(int j=0;j<4;j++)
{
for(int i=0;i<4;i=i+1)
{
cout<<c[i][j];
}
}
cout<<endl;
}
}
}
return 0;
}