fork download
  1. import java.util.regex.*;
  2.  
  3. class IdeOne {
  4.  
  5. public static void main(String[] args) {
  6. String s2 = "K000";
  7. String a2 = "";
  8. String n2 = "";
  9.  
  10. Pattern p2 = Pattern.compile("^.*([A-Z])");
  11. Matcher m2 = p2.matcher(s2);
  12. if (m2.find()) {
  13. int pos2 = m2.end();
  14. a2 = s2.substring(0, pos2);
  15. n2 = s2.substring(pos2);
  16. }
  17.  
  18. System.out.println(a2);
  19. System.out.println(n2);
  20. }
  21. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
K
000