Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem A: Word Shadow Source file: shadow.cpp for java, or.c) Input file: shadow.in in reality, when we read an English word we normally do not

image text in transcribed

Problem A: Word Shadow Source file: shadow.cpp for java, or.c) Input file: shadow.in in reality, when we read an English word we normally do not read every single letter of that word but rather the word's "shadow" recalls its pronunciation and meaning from our brain. The word's shadow consists of the same number of letters that compose the actual word with first and last letters (of the word) in their original positions while the rest of letters are interchanged symmetrically as shown in Figure 1; for example the sentence "I love programming" still can be read if it is written as "I Ivoe pnimmargorg". Your task is to write a program that reads a set of sentences each of which is composed of a number of words; for each sentence, the program should produce another sentence which contains the exact number of words in their shadow form prog r amming pn immargor g actual word shadow word Example of conversion of a word to its shadow word Input In a single execution, the program should run for "T" test cases. The first line of the input file contains the integer variable T. The rest of the T lines that follow, each contains two pieces of information about one sentence; the number of words (W) in the sentence and the text of the sentence itself. The variable W ranges from 1 to 10 inclusive. Each word may contain up to 12 letters. There is exactly one space between any two consecutive words in a sentence and sentences are entirely in small letters and do not contain any punctuation mark or special characters. Output Your program should produce for each test case, a sentence written in shadow format; words that are composed of less than four letters do not have shadow and if the number of letters composing a word is odd and more than four, the position of the central letter remains unchanged. Sample Input Sample Output 7 if anything can go wrong it will 8 a thing of beauty is a joy forevera tnihg of btuaey is a joy feveror if anihtyng can go wnorg it wlil

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago