#include <iostream>
#include <string>
using namespace std;

//int main() {
//  char str;
//  char output[30][30];
//  while (scanf("%s", &str) != EOF) {
//      printf("%d\n", sizeof(str));
//
//  }
//}


int main() {
    string str;
    char output[30][30];
    int len = 0;
    int type = -1;
    int h = 0;
    int n1 = 0, n2 = 0, n3 = 0;
    while (cin >> str) {
        int
        len = str.size();
        //或者str.length也可以,都是不包括\0的字符串真实长度
        //printf("%d\n", len);
        //计算左右和底边字符数量
        type = (len + 2) % 3;
        h = (len + 2) / 3;
        for (int i = 0; i < 30; i++) {
            for (int j = 0; j < 30; j++) {
                output[i][j] = ' ';
            }
        }
        if (type == 0) {
            n1 = n2 = n3 = h;
        } else {
            n1 = n3 = h;
            n2 = h + type;
        }
        int i = 0;
        for (i = 0; i < h; i++) {
            output[i][0] = str[i];
        }
        for (; i < h + n2 - 1; i++) {
            output[h - 1][i - h + 1] = str[i];
        }
        for (; i < len; i++) {
            output[len - 1 - i][n2 - 1] = str[i];
        }

        //输出
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < n2; j++) {
                printf("%c", output[i][j]);
            }
            printf("\n");
        }
    }
}

算是一道很简单的题啦,很久不做了,中间出了点小bug;正好重装了一下编译器,复习了一下如何调试;