# groupe.py : groupe par groupe de 4 ou 5 et lg de ligne (5 c, 80 c)

import string
import sys

def is_maj(car):
        if string.ascii_uppercase.find(car) == -1:
                return 0
        else:
                return 1
#------------------------------------------------------------
LG_GROUP = 5
LG_LIGNE = 60
if len(sys.argv) > 1 :
        ARG_UN  = sys.argv[1]
        if ARG_UN == "help":
                print("syntaxe: groupe.py [line_length [group_length]]")
                sys.exit(1)
        LG_LIGNE = int( ARG_UN )
        if len(sys.argv) > 2:
                LG_GROUP = int( sys.argv[2] )

leTexte = sys.stdin.readlines()

imprime = ""
cpt = 0
lglic = 0
for i in range(len(leTexte)):
        ch = leTexte[i]
        ch = ch.upper()
        for j in range(len(ch)):
                if not is_maj(ch[j]):
                        continue
                imprime = imprime + ch[j]
                cpt = cpt + 1
                lglic = lglic + 1
                if (cpt % LG_GROUP) == 0:
                        imprime = imprime + " "
                        lglic = lglic + 1
                if lglic == LG_LIGNE :
                        print(imprime)
                        imprime = ""
                        lglic = 0

print(imprime)
