<?php
$text =
"Дым табачный воздух выел.
Комната —
глава в крученыховском аде.
Вспомни —
за этим окном
впервые
руки твои, исступлённый, гладил.
Сегодня сидишь вот,
сердце в железе.
День ещё —
выгонишь,
может быть, изругав.
В мутной передней долго не влезет
сломанная дрожью рука в рукав.";
main($text);
function prepareTxt($txt)
{
$txtLines = [];
foreach ( $txtArr as $line ) {
}
$lenOfTxtLines = [];
foreach ( $txtLines as $line ) {
}
$maxLineLen = max($lenOfTxtLines);
$txtLinesPadded = [];
foreach ( $txtLines as $line ) {
}
return $txtLinesPadded;
}
function reverseTxt($txt, $delimiter)
{
$reversedTxt = "";
foreach ( range(0, ($lineLength - 1)) as $elem ) { foreach ( $txt as $chunk ) {
$reversedTxt .= $chunk[$elem] . $delimiter;
}
$reversedTxt .= "\n";
}
return $reversedTxt;
}
function main($txt, $delimiter=" | ")
{
$rawTxt = prepareTxt($txt);
$result = reverseTxt($rawTxt, $delimiter);
print $result;
return 1;
}
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7Cm1iX2ludGVybmFsX2VuY29kaW5nKCd1dGYtOCcpOwoKJHRleHQgPQoi0JTRi9C8INGC0LDQsdCw0YfQvdGL0Lkg0LLQvtC30LTRg9GFINCy0YvQtdC7LgrQmtC+0LzQvdCw0YLQsCDigJQK0LPQu9Cw0LLQsCDQsiDQutGA0YPRh9C10L3Ri9GF0L7QstGB0LrQvtC8INCw0LTQtS4K0JLRgdC/0L7QvNC90Lgg4oCUCtC30LAg0Y3RgtC40Lwg0L7QutC90L7QvArQstC/0LXRgNCy0YvQtQrRgNGD0LrQuCDRgtCy0L7QuCwg0LjRgdGB0YLRg9C/0LvRkdC90L3Ri9C5LCDQs9C70LDQtNC40LsuCtCh0LXQs9C+0LTQvdGPINGB0LjQtNC40YjRjCDQstC+0YIsCtGB0LXRgNC00YbQtSDQsiDQttC10LvQtdC30LUuCtCU0LXQvdGMINC10YnRkSDigJQK0LLRi9Cz0L7QvdC40YjRjCwK0LzQvtC20LXRgi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