1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String input = scan.nextLine();
scan.close();
StringTokenizer st = new StringTokenizer(input," ");
// input(문자열)값을 " "(공백)기준으로 각각 나누어 토큰화
System.out.println(st.countTokens()); // 나누어진 토큰 갯수를 출력
}
}
|
cs |
'Algorithm > 백준' 카테고리의 다른 글
백준 2525 (오븐 시계) (0) | 2022.06.22 |
---|---|
백준 2884 (알람 시계) (0) | 2022.06.21 |
백준 2754 (학점 계산) (0) | 2022.06.19 |
백준 2744 (대소문자 바꾸기) (0) | 2022.06.19 |
백준 2738 (행렬 덧셈) (0) | 2022.06.19 |