I need to write a program where the user enters an object string like "HelloIamYourNeighbor" and returns "Hello I am your neighbors"
so far I have been able to convert the uppercase to lowers case but I am having trouble inserting the spaces between the capital letters.
for (int i = 0; i < input.length(); i++) {
if (input.contains("(?=\\p{Lu})")) {
str.append(" ");
}
if (Character.isUpperCase(input.charAt(i)) && i != 0) {
str.setCharAt(i, Character.toLowerCase(input.charAt(i)));
}
}
System.out.println(str);