#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

void removeWords(char * buf)
{
    char * s = buf;
    while(ispunct(*s) || isblank(*s)) ++s;
    while(isalnum(*s)) ++s;
    while(ispunct(*s) || isblank(*s)) ++s;
    memmove(buf,s,strlen(s)+1);

    s = buf + strlen(buf) - 1;
    while(ispunct(*s) || isblank(*s) || *s=='\n') --s;
    while(isalnum(*s)) --s;
    *s++ = '\n';
    *s = 0;
}

int main()
{
    #define  MAXLEN 512
    char buf[MAXLEN];
    for(int no = 1; fgets(buf,MAXLEN,stdin); ++no)
    {
        if (no%2==0) removeWords(buf);
        printf("%3d: %s",no,buf);
    }
}
