import java.util.HashMap;
import java.util.Map;
import java.io.*;
public class test{
private static String WORD = "0";
private static String SENTENCE = "1";
public static Map getCount(String str) {
str = str.replace(".", "#");
str = str.replace("?", "#");
str = str.replace("!", "#");
int wordCount = str.split(" ").length;
int sentenceCount = str.split("#").length;
Map map = new HashMap();
map.put(WORD, wordCount);
map.put(SENTENCE, sentenceCount);
return map;
}
public static void main(String[] args) throws NumberFormatException, IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String x=br.readLine();
Map map = getCount(x);
System.out.println("单词数量: "+map.get(WORD));
System.out.println("句子数量: " + map.get(SENTENCE));
}
}