#include "stdio.h"
int main()
{int i,n=0,st=1;
char s[200]; gets(s); for(i=0;s[i];i++)if(s[i]>='A'&&s[i]<='Z'||s[i]>='a'&&s[i]<='z')
{
st=1;
printf("%c",s[i]);
}
else
{
if(st==1){printf("\n");n++;}
st=0;
}
printf("\nTotal has %d words.\n",n); getch(); return 0;}