Untitled
unknown
plain_text
3 years ago
627 B
6
Indexable
import java.util.Scanner;
public class Lab6
{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String input = scanner.nextLine();
int vowelsSum = 0;
for (int i = 0; i < input.length(); i++) {
if (input.charAt(i) == 'a') {
vowelsSum+=1;
} else if (input.charAt(i) == 'e') {
vowelsSum+=2;
} else if (input.charAt(i) == 'i') {
vowelsSum +=3;
} else if (input.charAt(i) == 'o') {
vowelsSum += 4;
} else if (input.charAt(i) == 'u') {
vowelsSum +=5;
}
}
System.out.println(vowelsSum);
}
}
Editor is loading...