Added 14 solutions

This commit is contained in:
rshaghoulian
2017-02-09 02:12:38 -08:00
parent dd793be41b
commit 354f4d9abb
26 changed files with 496 additions and 32 deletions
@@ -0,0 +1,29 @@
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
/* Read input */
Scanner scan = new Scanner(System.in);
String s = scan.nextLine();
scan.close();
/* Must trim String to pass test cases. Still unclear why it's necessary */
s = s.trim();
/* Check special cases */
if (s.length() == 0) {
System.out.println(0);
return;
}
/* Split on all non-alphabetic characters */
String [] words = s.split("[^a-zA-Z]+");
/* Print output */
System.out.println(words.length);
for (String word : words) {
System.out.println(word);
}
}
}