fork download
  1. class M{
  2. static void c(String s){
  3. for(String x : s.split("(?=[^\\d]+)|(?<=[^\\d]+)")){
  4. System.out.print(x.matches("\\d+")
  5. ? new Long(x) + 1
  6. : x);
  7. }
  8. }
  9.  
  10. public static void main(String[] a){
  11. c("123test");
  12. System.out.println();
  13. c("test123");
  14. System.out.println();
  15. c("te123st");
  16. System.out.println();
  17. c("test 123 test");
  18. System.out.println();
  19. c("7teststring134this 123test string59 100");
  20. }
  21. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
124test
test124
te124st
test 124 test
8teststring135this 124test string60 101