HR자바 Java String Tokens

개요[ | ]

HR자바 Java String Tokens
해커랭크 Java
# 문제 비고
HR자바 Strings e
14 HR자바 Java Strings Introduction
15 HR자바 Java Substring
16 HR자바 Java Substring Comparisons
17 HR자바 Java String Reverse
18 HR자바 Java Anagrams
19 HR자바 Java String Tokens
20 HR자바 Pattern Syntax Checker
21 HR자바 Java Regex
22 HR자바 Java Regex 2 - Duplicate Words
23 HR자바 Valid Username Regular Expression
24 HR자바 Tag Content Extractor

import java.io.*;
import java.util.*;

public class Solution {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.nextLine();
        scan.close();
        s = s.trim();
        if( s.length() == 0 ) {
            System.out.println(0);
            return;
        }
        String[] words = s.split("[^a-zA-Z]+");
        System.out.println(words.length);
        for(String word: words) {
            System.out.println(word);
        }
    }
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}