This accepted answer by halex to the question Java Unicode String length provides Java code which uses a regex to extract each letter from a String:
String s = "ஈஉஐ రాజైన"; // Tamil/Telugu text input
List<String> characters = new ArrayList<String>();
Pattern pat = Pattern.compile("\u0B95\u0BCD\u0BB7\\p{M}?|\\p{L}\\p{M}?");
Matcher matcher = pat.matcher(s);
while (matcher.find()) {
characters.add(matcher.group());
}
System.out.println(characters);
System.out.println(characters.size()); // Length
It was written for processing Tamil, but it works fine for your Telugu string as well. I just ran it, and it extracted 21 Telugu letters రా, జు, ల, కు, రా, జై, న, యీ, మ, న, వి, భు, ని, పూ, జ, సే, యు, ట, కు, రం, డి (plus 7 spaces = 28, which is what you expect).
(skomisa's comment to the question, 2022-02-16 15:31:00Z) This solves it.