aboutsummaryrefslogtreecommitdiff
path: root/games/squ.awk
blob: 0d8f9210fa556e0b8d892dca41e30304ca1a32e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
# Make a square out of each line of input
{
    str = toupper($0)
    len = length(str)
    for (i = 1; i <= len; i++)
        let[i - 1] = substr(str, i, 1)
    for (j in let)
        for (k in let)
            printf (k < len - 1) ? "%s " : "%s\n", let[(k + j) % len]
}