So it should work like that
squareDigits("a22b") on "a44b"
squareDigits("a9b2") on "a81b4"
What I have got so far :
public class Code {
public static void main(String[] args) {
String ok = "a2b9";
System.out.println(squareDigits(ok)); // "a81b4"
}
public static String squareDigits(String s) {
char[] pena = s.toCharArray();
int aboba;
for (char c : pena) {
if (Character.isDigit(c)) {
String s1 = Character.toString(c);
int b = Integer.parseInt(s1);
aboba = b * b;
System.out.println(aboba);
}
}
return "";
}
}
Im only beginner and this would very help me out