val height = 5
val width = 72
val matrix = Array(height) {CharArray(width){ '*' }}
fun cantor(start: Int, len: Int, index: Int) {
val seg = len / 3
if( seg == 0 ) return
for(i in index until height) {
for (j in start + seg until start + seg * 2) matrix[i][j] = ' '
}
cantor(start, seg, index + 1)
cantor(start + seg * 2, seg, index + 1)
}
fun main(args: Array<String>) {
cantor(0, width, 1)
matrix.forEach { println(it) }
}
dmFsIGhlaWdodCA9IDUKdmFsIHdpZHRoID0gNzIKCnZhbCBtYXRyaXggPSBBcnJheShoZWlnaHQpIHtDaGFyQXJyYXkod2lkdGgpeyAnKicgfX0KCmZ1biBjYW50b3Ioc3RhcnQ6IEludCwgbGVuOiBJbnQsIGluZGV4OiBJbnQpIHsKCSAKCSB2YWwgc2VnID0gbGVuIC8gMwoKICAgICBpZiggc2VnID09IDAgKSByZXR1cm4KCiAgICAgZm9yKGkgaW4gaW5kZXggdW50aWwgaGVpZ2h0KSB7CgogICAgICAgICBmb3IgKGogaW4gc3RhcnQgKyBzZWcgdW50aWwgc3RhcnQgKyBzZWcgKiAyKSBtYXRyaXhbaV1bal0gPSAnICcgICAgICAgCiAgICAgfQoKICAgICBjYW50b3Ioc3RhcnQsIHNlZywgaW5kZXggKyAxKQoKICAgICBjYW50b3Ioc3RhcnQgKyBzZWcgKiAyLCBzZWcsIGluZGV4ICsgMSkKfQoKZnVuIG1haW4oYXJnczogQXJyYXk8U3RyaW5nPikgewoJCgljYW50b3IoMCwgd2lkdGgsIDEpCgoJbWF0cml4LmZvckVhY2ggeyBwcmludGxuKGl0KSB9IAp9