Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that accepts as inputs an asciiz string consisting of a sequence

ID: 670144 • Letter: W

Question

Write a program that accepts as inputs an asciiz string consisting of a sequence of words separated by one or more blanks, and outputs the string with all blanks removed. Example:


                                                input:    "the quick brown fox"
                                                output: "thequickbrownfox"

The user should be able to enter any string of maximum length 64 characters after the prompt “Enter the input string:” and the result will be displayed on the screen as “The output string is:”

Please be done in SPIM!. No erros please. In need of a reference.

Explanation / Answer

import java.util.*;

class Rem

{

public static void main(String args[])

{

String str;

Scanner s=new Scanner(System.in);

System.out.println("Enter the string");

str=s.nextLIne();

str whitespaces=str;

System.out.println("Before removing whitespaces:"+str);

str withoutwhitespaces=whitespaces.replaceAll("\s","")

System.out.println("After removing whitespaces:"+without whitespaces);

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote