Kat H.

asked • 04/26/21

Sher. Write a word shortener.

Write a word shortener. Read in a string (you may assume no spaces). If it is 4 characters or less, print it back out. If it is more than 4 characters, print just the first two followed by the last two.


Samples:

Input: bob Output: bob
Input: programming Output: prng


Code:


#include <iostream>

#include <string>

using namespace std;


//Turn off loops - you should not need them!

#define for "OhNoYouDont"

#define while "GetThatOutOfMyKitchen"



//Do not modify anything on or above the line below this

//YOUR_CODE_BELOW

int main()

{

//YOUR_CODE

}

1 Expert Answer

By:

Patrick B. answered • 04/27/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.