Question: Given a string pathway with asteroids marked by asterisks ( ) and the closest nonasteroid character to its left. Example Process: For the input orif

Given a string pathway with asteroids marked by asterisks () and the closest nonasteroid character to its left.
Example Process:
For the input "orif*ginnn**".
Shield at the 1st asteroid 0: removes ?1**' and closest nonasteroid character to its left 'e'. Result: "origii*nnn**"
Shield at the 2nd asteroid 0 : removes ?'**1 and closest nonasteroid character to its left 'e'. Result: "originnn**"
Shield at the 3rd asteroid 0: removes '"
Shield at the last asteroid 0 : removes '?**' and closest nonasteroid character to its left 'n'. Result: "origin"
Input:
A string representing the pathway
Output:
A string representing the cleared pathway without any asteroids
Given a string pathway with asteroids marked by

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!