<?php


function retrieveStrings()
{
    if (isset($_POST['input'])) {
        $strings = explode(, $_POST['input']);
    } else {
        $strings = ['abcd', '123456789', 'abcdef', '1234567'];
    }
    return $strings;
}


function setInput()
{
    echo join(, retrieveStrings());
}


function setOutput()
{
    $strings = retrieveStrings();

    
    
    $strings = array_map('trim', $strings);
    $strings = array_filter($strings);

    if (!empty($strings)) {
        usort($strings, function ($a, $b) {
            return strlen($b) - strlen($a);
        });
        $max_len = strlen($strings[0]);
        $min_len = strlen($strings[count($strings) - 1]);
        foreach ($strings as $s) {
            $length = strlen($s);
            if ($length == $max_len) {
                $predicate = ;
            } elseif ($length == $min_len) {
                $predicate = ;
            } else {
                $predicate = ;
            }
            echo ;
        }
    }
}

?>


<!DOCTYPE html>
<html lang=>

<head>
    <style>
        div {
            margin-top: 4ch;
            margin-bottom: 4ch;
        }

        label {
            display: block;
            margin-bottom: 1ch;
        }

        textarea {
            display: block;
        }

        input {
            display: block;
            margin-top: 4ch;
            margin-bottom: 4ch;
        }
    </style>
</head>


<body>
    <main>
        <form action=<?php echo $_SERVER['SCRIPT_NAME'] ?> method= accept-charset=>
            <div>
                <label for=>Input:
                </label>
                <textarea rows='20' cols='80' name='input'><?php setInput(); ?></textarea>
                </label>
            </div>
            <input type= value=>
            </input>
            <div>
                <label for=>Output:
                </label>
                <textarea rows='20' cols='80' name='output'><?php setOutput(); ?></textarea>
            </div>
        </form>
    </main>
</body>

</html>