Solución

@vm24042_578b2dc2·9/5/2026TypeScript
solution.tsTypeScript
public class Solution {
    public int countConsonants(String text) {
        int counter = 0;
        text = text.toLowerCase();
        for (int i = 0; i < text.length(); i++){
            if(text.charAt(i) >= 'a' && text.charAt(i) <= 'z'){
                if (text.charAt(i) != 'a' && text.charAt(i) != 'e' && text.charAt(i) != 'i' && text.charAt(i) != 'o' &&   text.charAt(i) != 'u' ){
                    counter++;
                }
            }
        } return counter;
    }
}
0respuestas
Respuestas

Aún no hay respuestas

¡Sé el primero en responder!

Escribir un comentario

Recuerda ser amable. Estás comentando la solución de otra persona. Comparte tu perspectiva de forma constructiva y respetuosa.

Debes iniciar sesión para publicar un comentario.