Logo
(追記) (追記ここまで)

13939번 - Imena 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 32 MB41823518455.255%

문제

Little Mirko likes to type and often gets bored during class, which is why his teacher assigned him a task.

Mirko must retype a book​ that contains N space-separated sentences. In this book, a sentence​ is an array of one or more space-separated words, where only the last word’s character is a punctuation mark ( '.', '?' or '!' ). The rest of the words do not contain punctuation marks.

Words are arrays of characters​, either lowercase or uppercase letters of the English alphabet, or digits or, exceptionally, a punctuation mark at the end of the last word in the sentence.

Although he likes typing sentences, Mirko doesn’t like typing names. A name​ is a word that starts with an uppercase letter of the English alphabet, whereas the rest of the characters are lowercase letters of the English alphabet, except the last character, which can be the punctuation mark. Before he decides to retype the whole thing, Mirko wants to know how many names there are in each sentence of the book​. Write a programme to help him!

입력

The first line of input contains the integer N (1 ≤ N ≤ 5), the number from the task.

The second line contains N sentences from the book. The total number of characters in the book will not exceed 1000.

출력

You must output N lines. The i th line contains the number of names in the i th sentence.

제한

예제 입력 1

1
Spavas li Mirno del Potro Juan martine?

예제 출력 1

4

예제 입력 2

2
An4 voli Milovana. Ana nabra par Banana.

예제 출력 2

1
2

힌트

출처

Contest > Croatian Open Competition in Informatics > COCI 2016/2017 > Contest #3 1번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /