[SOLVED] COM1002 Lab 6

30.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

Rate this product

Write a program that takes a character sequence and an index sequence as inputs and removes the characters in the given indexes with the given order:

Ex:          abcdef  2 0 3 -1

Keeping the given character sequence in an array:

[‘a’, ‘b’,’c’,’d’,’e’,’f’]

AGer removing the character at the index 2, the array becomes:

[‘a’, ‘b’,’d’,’e’,’f’]

Then remove the character at the index 0:

[ ‘b’,’d’,’e’,’f’]

Then 3:

[ ‘b’,’d’,’e’]

You are leG with this data. Please print the remaining characters to the output starMng from index 0:

> bde

Input Format:

<character sequence>[Space]{<indexes>[Space]}* -1

{.}* -> zero or more

All the index sequences will be terminated with -1.

Output Format:

<remaining character sequence>\n

*You can assume that the character sequence will not exceed 100 characters.

*Invalid indexes may be specified as well. You need to check if it is in the data range.

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.