• + 1 comment

    I did it this way

    int main(){
        char* s = (char *)malloc(10240 * sizeof(char));
        scanf("%s",s);
        int len = strlen(s);
        int columns = ceil(sqrt(len));
        for(int i = 0; i < columns; i++) {
            for(int j = i; j < len; j += columns) {
                printf("%c", s[j]);
            }
            printf(" ");
        }
        return 0;
    }
    

    all of the test cases take 0s