If a user\'s input string matches a known text message abbreviation, output the
ID: 3939122 • Letter: I
Question
If a user's input string matches a known text message abbreviation, output the unabbreviated form, else output: Unknown. Support two abbreviations: LOL -- laughing out loud, and IDK --1 don't know. Sample input/output: Input an abbreviation: LOL laughing out loud Expand to also decode these abbreviations. BFF -- best friends forever IMHO -- in my humble opinion TMI -- too much information import java.util.Scanner; public class TextMsgAbbreviation {public static void main(String[] args) {/* Type your code here. */return;}}Explanation / Answer
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
System.out.println("input an abbreviation :");
String str=s.nextLine();
String res;
if(str=="LOL")res="laughing out loud";
else if(str=="IDK")res="I Dont Know";
else if(str=="BFF")res="Best friends forever";
else if(str=="IMHO")res="in my humble opinion";
else if(str=="TMI")res="too much information";
System.out.println(res);
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.