fork(1) download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.Matcher;
  5. import java.util.regex.Pattern;
  6.  
  7. class Ideone
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. String s = "h3jv28sf";
  12. Matcher m = Pattern.compile("([a-z])([0-9]+)").matcher(s);
  13. while (m.find()) {
  14. m.appendReplacement(sb, s_repeat(m.group(1), Integer.parseInt(m.group(2))));
  15. }
  16. m.appendTail(sb);
  17. System.out.println(sb.toString());
  18. }
  19.  
  20. private static String s_repeat(String string, int count) {
  21. StringBuilder sb = new StringBuilder();
  22. for(int i = 0; i < count; i++){
  23. sb.append(string);
  24. }
  25. return sb.toString();
  26. }
  27. }
Success #stdin #stdout 0.12s 320576KB
stdin
Standard input is empty
stdout
hhhjvvvvvvvvvvvvvvvvvvvvvvvvvvvvsf