March 5, 2005
     

Program / Task Name:

   Text Me

Level:

 

 Novice / Advanced

Point Value:

 

 5

Solution(s):

 

 prob05.c

Data File(s):

 

 prob05.in, prob05.in2

 
C programmers: your program name must be: prob05.exe
JAVA programmers: your program name must be: prob05.class

 

Task Description

This program provides a simple decoder of a cellular phone text messaging input.  Given an input file (prob05.in) with a string of phone pad keys and spaces, display the actual text message being sent.  Each message input stream will end with an Asterisk, which denotes SEND.

For purposes of this problem assume that key/letter associations are arranged as follows:

1

2

3

 @.?1

ABC2

DEF3

4

5

6

GHI4

JKL5

MNO6

7

8

9

PQRS7

TUV8

WXYZ9

*

0

#

send

 Zero

space

Pauses in the typing sequence are represented by spaces in the file.  Notice, like on a regular phone, changing keys does not require you to pause between letters.  Also keying can roll over to the beginning of the associated letters.  (i.e. pressing 5 once results in a J and pressing 5 five times also results in a J.)

Program Input (prob05.in)

 

4433 555 555 666* 9666 777 555 3* 222 9992 #555 8888777 * 

 

Program Output

Print the letters as you interpret them, start a new line anytime you see the send key was pressed.

HELLO

WORLD

CYA L8R

 

 

   
  (c) 2005 Hewlett-Packard Company