#P2005. ACSL 2015-2016 Intermediate Division Contest #2 ACSL STRINGS
ACSL 2015-2016 Intermediate Division Contest #2 ACSL STRINGS
Every computer language has different string functions. For this program you will be asked to code algorithms that replicate the ACSL string functions listed below, all of which split strings up into separate parts:
- char_split (a$, n, 'char') – char_split divides a given string (a$) into substrings of length n separated by the given character.
- strrem (a$, b$) – removes all occurrences of b$.
- strchr (a$, b$) – strchr searches a$ for the first occurrence of b$ and returns the characters of a$ before the first occurrence of b$.
- strtok(a$, b$) – strtok splits a given string (a$) into substrings each time the character b$ is found. Substrings must be separated by spaces.
- wordwrap(a$, n, b$) – wordwrap outputs the substrings of a$ that are a maximum of n characters in length or that begin with the character b$. Substrings must be separated by spaces.
INPUT FORMAT
There will be 5 lines of input. Each line of input will contain a character string (a$) and the data for the arguments needed for the like-numbered functions above. The length of a$ will be fewer than 25 characters.
OUTPUT FORMAT
For each line of input print the result of applying the like numbered function above.
SAMPLE
INPUT
MISSISSIPPI, 2, *
MISSISSIPPI, IS
MISSISSIPPI, P
MISSISSIPPI, I
MISSISSIPPI, 2, I
OUTPUT
MI*SS*IS*SI*PP*I
MSSIPPI
MISSISSI
M ISS ISS IPP I
M IS S IS S IP P I