class Main {
public static void main(String args[])
throws java.io.IOException {
Scanner scanner = new Scanner(System.in);
char choice;
int count = 0;
do {
System.out.print("Введите любой символ: ");
choice = scanner.next().charAt(0);
System.out.println();
count++;
} while (choice != '.' && choice != 'q');
switch(choice) {
case '.':
System.out.println("Вы нажали Enter " + count + " раз.");
break;
case 'q':
break;
}
}
}