#include <stdio.h>

int main(void) {
	long a = 0;
	char c;
	while(1)
	{
		scanf("%c", &c);
		printf("%c",c);
		if(c == '$')
			break;
		else if(c == ',' || c == ':')
		{
			printf("\n");
			a++;
		}
	}
	printf("%ld",a);
	return 0;
}
