fork download
  1. import java.util.regex.*;
  2.  
  3. class Ideone {
  4. public static void main (String[] args) throws java.lang.Exception {
  5. String s = "BByTTheWay";
  6. Pattern p = Pattern.compile("[A-Z][a-z]*");
  7. Matcher m = p.matcher(s);
  8. String r = "";
  9. while (m.find()) {
  10. r = r + m.group(0) + " ";
  11. }
  12. System.out.println(r + s);
  13. }
  14. }
Success #stdin #stdout 0.12s 52400KB
stdin
Standard input is empty
stdout
B By T The Way BByTTheWay