import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String input; input = scnr.nextLine(); input = input.replaceAll("[^a-zA-Z]", ""); System.out.println(input); } }
Added by Bryan P.
Close
Step 1
util package to allow user input. Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 91 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write code for this program in Java A company wishes to encode its data. the data is in the form of a string and is case sensitive. They wish to encode the data with respect to a specific character. They wish to count the number of times the character reoccurs in the given data so that they can encode the data accordingly. Write the algorithm to find the count of the specific character in the given data. Input: The first line of the input consists of a string - data representing the data to be encoded. The second line consists of a character - coder representing the character to be counted in the data. Output: Print an integer representing the count of the specific character. If the required character is not found then print 0.
Akash M.
4.19 LAB: Print string in reverse Write a program that takes in a line of text as input and outputs that line of text in reverse. The program repeats, ending when the user enters "Done", "done", or "d" for the line of text. Ex: If the input is: Hello there Hey done The output is: ereht olleH yeH
Sri K.
'1. Write a Java program that prompts the user to enter a line of text and outputs the number of digits, the number of lower case letter and the number of upper case letter in that text.'
Shelayah R.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD