import java.util.Scanner;
public class JavaProgram
{
public static void main(String args[])
{
String strOrig, word;
Scanner scan = new Scanner(System.in);
System.out.print("Enter a String : ");
strOrig = scan.nextLine();
System.out.print("Enter a Word to be Delete from the String : ");
word = scan.nextLine();
System.out.print("Deleting all '" + word + "' from '" + strOrig + "'...\n");
strOrig = strOrig.replaceAll(word, "");
System.out.print("Specified word deleted Successfully from the String..!!");
System.out.print("\nNow the String is :\n");
System.out.print(strOrig);
}
}
If the answers is incorrect or not given, you can answer the above question in the comment box. If the answers is incorrect or not given, you can answer the above question in the comment box.