Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that accepts a positive integer $N$ indicating $N$ test cases. For each test case, the program accepts a word $W$ that

Write a C++ program that accepts a positive integer $N$ indicating $N$ test cases.

For each test case, the program accepts a word $W$ that contains only alphabets and stars (*). The program then shifts all stars to the left (hence also shifts all alphabets to the right) while maintaining the initial ordering of the alphabets.

For example, given the word $W$ below:

```

T**es*t***IsE***a******s*y**

```

After shifting, the word should become:

```

******************TestIsEasy

```

## Input Range

*The input to this program will only come from the following range. (Your code does not need to check if the input is in this range).*

- $1 \leq N \leq 10$

- $1 \leq W.length() \leq 100$

- $W$ contains alphabets and stars only.

-------------------------------------------------------------------------------------------

#include

using namespace std;

int main()

{

int N;

cout << "N -> ";

cin >> N;

for (int i = 1; i <= N; ++i)

{

cout << " Input:" << endl;

// --- Write your code here ---

cout << "Output:" << endl;

// --- Write your code here ---

}

}

--------------------------------------------------------------------

## Sample Run 1

```

N -> 4

Input:

**p***ro****gra**m*mi**n*g***

Output:

******************programming

Input:

***bie**be*ri***sba**rb****er

Output:

***************bieberisbarber

Input:

t**i**meis*g*ol**d**

Output:

**********timeisgold

Input:

Q**ata***rWo**rl*d*C**u*p

Output:

************QatarWorldCup

```

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

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

Be familiar with the different perspectives of service quality.

Answered: 1 week ago

Question

Describe key customer feedback collection tools.

Answered: 1 week ago

Question

Know what customers expect from the firm when they complain.

Answered: 1 week ago