Giving you an idea you can try the code below
Scanner myObj = new Scanner(System.in); // Create a Scanner object
System.out.println("Please enter your text!");
String text = myObj.nextLine(); // Read user input
System.out.println("the character count is: " + text.Length()); //This will also count spaces
//If you don't want to included white spaces
String noSpaces = text.replace(" ", "");
System.out.println("the character count is: " + noSpaces.Length());
Getting multiple userInput with conditions
Scanner myObj = new Scanner(System.in); // Create a Scanner object
System.out.println("Please enter your text!");
System.out.println("1=UPPERCASE, 2-Count,3=lowercase,4=remove spaces!");
while(myObj.hasNextLine()){
String text = myObj.nextLine(); // Read user input
String text1 = myObj.nextLine();
switch (text1) {
case "1":
//your code here
break;
case "2":
//your code here
break;
case "3":
//your code here
break;
case "4":
//your code here
break;
default:
break;
}
}