#include<string>
using namespace std;
int main()
{
int m = 0, x = 0, check = 0;
char arr[16][16];
for (int i = 0; i < 16; i++)
for (int j = 0; j < 16; j++)
arr[i][j] = ' ';
string s;
getline(cin, s);
for (int i = 1; i * i <= s.length(); i++)
m = i;
if (m * m < s.length())
m++;
for (int i = 0; i < m; i++)
{
for (int j = 0; j < m; j++)
{
arr[i][j] = s[x++];
if (x == s.length())
break;
}
if (x == s.length())
break;
}
for (int i = 0; i < m; i++)
for (int j = 0; j < m; j++)
cout << arr[j][i];
cout << endl;
return 0;
}
沒有留言:
張貼留言