Răspuns:
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
char s[21][21];
unsigned int n,k;
cin>>n;
cin.get();
for(unsigned int i=1;i<=n;i++)
{
cin.get(s[i],21);
cin.get();
}
cin>>k;
for(unsigned int i=1;i<=n;i++)
{
if(strlen(s[i])==k)
cout<<s[i]<<" ";
}
for(unsigned int i=1;i<=n;i++)
{
if(strlen(s[i])!=k)
cout<<s[i]<<" ";
}
}
Explicație: