void refresh() {
        StringBuilder sb = new StringBuilder(L);

        int gapCount = line.size() - 1;
        if (gapCount == 0) {
            sb.append(line.get(0));
            for (int i = L - sb.length(); i > 0; i--) {
                sb.append(' ');
            }
            result.add(sb.toString());
            line.clear();
            return;
        }

        int spaceCount = L - letterCount;
        int space = spaceCount / gapCount;
        int longCount = spaceCount - space * gapCount;
        int i = 0;
        for (; i < line.size() - 1; i++) {
            sb.append(line.get(i));
            for (int j = space; j > 0; j--) {
                sb.append(' ');
            }
            if (longCount > 0) {
                sb.append(' ');
                longCount--;
            }
        }
        sb.append(line.get(i));
        result.add(sb.toString());
        line.clear();
    }