Parsing a simple java string

I have a simple string i need to be parsed in java

String s = "images/c6.png";
String l = "images/h6.png";

Expected output is 6 and 6