fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Ideone {
  6.  
  7. public static void main (String[] args) {
  8. String text = "Hello, my identification is Mister Dude.";
  9. String[] words = text.replaceAll("[^(\\w )]+", "").toLowerCase().split(" ");
  10. for (String word : words) {
  11. if (word.length() <= 4) {
  12. System.out.println(word);
  13. }
  14. else {
  15. for (int i = 0; i <= word.length() - 4; i++) {
  16. System.out.println(word.substring(i, i + 4));
  17. }
  18. }
  19. }
  20. }
  21. }
Success #stdin #stdout 0.1s 320320KB
stdin
Standard input is empty
stdout
hell
ello
my
iden
dent
enti
ntif
tifi
ific
fica
icat
cati
atio
tion
is
mist
iste
ster
dude