public static function printWords($words, $spaces = 8, $line = 80)
    {
        $typesCount = count($words);
        $ret = '';
        $j = 0;

        foreach ($words as $type => $wordsByType) {
            foreach ($wordsByType as $len => $wordsByLen) {
                $count = round(($line - $spaces) / ($len + 9)); // strlen("'' => 1, ") = 9
                $i = 0;

                foreach ($wordsByLen as $word) {
                    if ($i === 0) {
                        $ret .= str_repeat(' ', $spaces);
                    }
                    $ret .= sprintf('\'%s\' => %s, ', $word, $type);
                    if (++$i === $count) {
                        $ret .= "\n";
                        $i = 0;
                    }
                }

                if ($i !== 0) {
                    $ret .= "\n";
                }
            }

            if (++$j < $typesCount) {
                $ret .= "\n";
            }
        }

        // Trim trailing spaces and return.
        return str_replace(" \n", "\n", $ret);
    }