Skip to content

Instantly share code, notes, and snippets.

@goyuninfo
Created March 26, 2020 18:50
Show Gist options
  • Save goyuninfo/3afec965ea1d9d4dc3cd48d8248d9a5b to your computer and use it in GitHub Desktop.
Save goyuninfo/3afec965ea1d9d4dc3cd48d8248d9a5b to your computer and use it in GitHub Desktop.
import java.io.*;
import java.util.*;
public class Solution {
public static void main(final String[] args) {
final Scanner scan = new Scanner(System.in);
if (!scan.hasNext()) {
System.out.print("0");
return;
}
final String s = scan.nextLine();
final String[] items = s.trim().split("[ !,?.\\_'@]+");
if (s == "") {
System.out.println("0");
} else if (s.length() > 400000) {
return;
} else {
System.out.println(items.length);
}
for (final String item : items) {
System.out.println(item);
}
scan.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment