#!/usr/bin/python
# coding: utf-8

# Dark I, copyright (c) 2016 Nick Montfort <nickm@nickm.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice and
# this notice are preserved. This file is offered as-is, without any warranty.
#
# 1 page program + all of Poe + for NaNoGenMo + 28 November 2016
# poe1.txt - poe5.txt, complete Poe from Gutenberg without license info
# cat poe*.txt | ./darki.py > darki.txt
#
# Updated 31 May 2018, changed "print" for Python 2 & 3 compatibility

import re, sys

lines = sys.stdin.readlines()

text = ' '.join(lines)
pattern = r'\bI\b[^.,;:!?]{2,}'
matches = re.findall(pattern, text)
sentences = []
longest = 0

for match in matches:
    sentence = re.sub('\r\n', '', match) + '.'
    sentence = re.sub(r' +', ' ', sentence)
    sentences.append(sentence)
    if len(sentence) > longest:
         longest = len(sentence)

print('Dark I\n\nNick Montfort\n\n')

for i in range(6, longest + 1):
    paragraph = '  '
    for sentence in sentences:
        if len(sentence) == i:
            paragraph += sentence + ' '
    if len(paragraph) > 2:
        print(paragraph)
