## CCC '07 J2 - I Speak TXTMSG

View as PDF

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type
##### Canadian Computing Competition: 2007 Stage 1, Junior #2

Text messaging using a cell phone is popular among teenagers. The messages can appear peculiar because short forms and symbols are used to abbreviate messages and hence reduce typing.

For example, LOL means "laughing out loud" and :-) is called an emoticon which looks like a happy face (on its side) and it indicates chuckling. This is all quite a mystery to some adults.

Write a program that will continually input a short form and output the translation for an adult using the following translation table:

Short Form Translation
CU see you
:-) I'm happy
:-( I'm unhappy
;-) wink
:-P stick out my tongue
(~.~) sleepy
TA totally awesome
CCC Canadian Computing Competition
CUZ because
TY thank-you
YW you're welcome
TTYL talk to you later

#### Input Specification

The user will enter text to be translated one line at a time. When the short form TTYL is entered, the program ends. Users may enter text that is found in the translation table, or they may enter other words. All entered text will be symbols or upper case letters. There will be no spaces and no quotation marks.

#### Output Specification

The program will output text immediately after each line of input. If the input is one of the phrases in the translation table, the output will be the translation; if the input does not appear in the table, the output will be the original word. The translation of the last short form entered TTYL should be output.

#### Sample Input

CCC
:-)
SQL
TTYL

#### Sample Output

Canadian Computing Competition
I'm happy
SQL
talk to you later

CCC problem statements in large part from the PEG OJ

• commented on April 26, 2021, 7:08 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• commented on Nov. 26, 2020, 8:39 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• commented on Nov. 26, 2020, 9:46 p.m.

The user will enter text to be translated one line at a time. When the short form TTYL is entered, the program ends. Users may enter text that is found in the translation table, or they may enter other words. All entered text will be symbols or upper case letters. There will be no spaces and no quotation marks.

• commented on Nov. 30, 2020, 2:38 a.m.

• commented on Nov. 25, 2020, 1:18 p.m. edit 4

Here are the translations for each TXTMSG, in Python dictionary:

(Triple-click to select all)

txt_diction = {'CU': 'see you', ':-)': "I'm happy", ':-(': "I'm unhappy", ';-)': 'wink', ':-p': 'stick out my tongue', '(~.~)': 'sleepy', 'TA': 'totally awesome', 'CCC': 'Canadian Computing Competition', 'CUZ': 'because', 'TY': 'thank-you', "YW": "you're welcome", 'TTYL': 'talk to you later'}

• commented on Aug. 20, 2020, 1:49 p.m.

Hello, can I have help with my code? It seems to work in Repl.it but I continue to get a key error. Any help would be greatly appreciated.

• commented on Aug. 20, 2020, 2:44 p.m.

• commented on Aug. 20, 2020, 3:36 p.m.

Thanks!

• commented on Aug. 15, 2020, 10:15 a.m.

How would I make the code now that the user has typed "TTYL"?

• commented on May 25, 2021, 2:31 p.m.

Your program has to keep getting the user's input until they enter "TTYL" at which point you need to stop getting input. Keep in mind, TTYL is a part of what you need to be translating, so make sure to include it when you're translating the words. Hope that helps.

• commented on June 19, 2020, 4:41 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• commented on April 3, 2020, 5:59 p.m.

Why does it keep on giving me WA? How should I output to get AC?

• commented on April 4, 2020, 5:25 p.m. edit 2

You have multiple typos in your output. Consider fixing them to match the table's translations exactly.

• commented on April 3, 2020, 4:24 p.m.

How many inputs are we supposed to get?

• commented on April 3, 2020, 4:34 p.m.

Your program should keep receiving input until the input is TTYL, which after your program should terminate.

• commented on Jan. 23, 2020, 10:57 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• commented on Aug. 21, 2019, 11:52 p.m.

Why does my code only display "talk" "from talk to you later??"

• commented on Aug. 22, 2019, 12:11 a.m.

Your program is displaying "talk to you later" properly. It only says "talk" in your output preview because the output preview only shows you the first few characters of the output.

• commented on Aug. 22, 2019, 12:46 a.m.

Thank you, do you know how to fix it?

• commented on Aug. 22, 2019, 10:05 a.m.

The output specification says:

If the input is one of the phrases in the translation table, the output will be the translation; if the input does not appear in the table, the output will be the original word.

• commented on Aug. 21, 2019, 11:49 p.m.

Why does my code only display "talk" "from talk to you later??"

• commented on Aug. 22, 2019, 2:31 a.m.

The output you see is clipped. I've looked through your submissions, and the reason for your WA isn't because your program is printing the last line incorrectly. Read through the problem statement again, and test your program with the sample input provided.

• commented on Feb. 25, 2019, 6:59 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• commented on Oct. 24, 2017, 6:17 p.m. edited

I always get a No such element Error, and I don't know why!

My code works on Netbeans but consistently gets errors here! I don't understand what's going on. :'(

• commented on Oct. 26, 2017, 2:05 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• commented on Dec. 10, 2017, 6:40 p.m.

Why does mine give the same error?

• commented on Dec. 10, 2017, 6:49 p.m.

Calling scanner inside your while loop.

• commented on Dec. 10, 2017, 6:52 p.m.

thanks