Explore Westonci.ca, the leading Q&A site where experts provide accurate and helpful answers to all your questions. Discover in-depth answers to your questions from a wide network of professionals on our user-friendly Q&A platform. Discover detailed answers to your questions from a wide network of experts on our comprehensive Q&A platform.
Sagot :
import java.util.*;
public class MyClass {
public static String useProperGrammar(String message){
String newMessage = "";
int count = 0;
for (int i = 0; i < message.length(); i++){
if(message.charAt(i) == '2'){
newMessage = newMessage + "to";
count ++;
}
else{
newMessage = newMessage + message.charAt(i);
}
}
System.out.println("Fixed "+count+" grammatical error(s):");
return newMessage;
}
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter a string: ");
String text = scan.nextLine();
System.out.println(useProperGrammar(text));
}
}
I hope this helps.
We hope our answers were helpful. Return anytime for more information and answers to any other questions you may have. We appreciate your time. Please revisit us for more reliable answers to any questions you may have. Get the answers you need at Westonci.ca. Stay informed by returning for our latest expert advice.