Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started