fork(1) download
  1. import java.util.regex.Matcher;
  2. import java.util.regex.Pattern;
  3.  
  4.  
  5. /* Name of the class has to be "Main" only if the class is public. */
  6. class Test
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. Pattern pat= Pattern.compile("\\G([0-9]++)([^0-9])");
  11. String text= "5x12e";
  12. StringBuilder result= new StringBuilder();
  13. Matcher match= pat.matcher(text);
  14. while ( match.find() ) {
  15. for (int i=0; i<Integer.parseInt(match.group(1)); i++) {
  16. result.append(match.group(2));
  17. }
  18. }
  19. System.out.println(result);
  20. }
  21.  
  22. }
  23.  
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
xxxxxeeeeeeeeeeee