COP 3502h Assignment 0 Space Expansion

$30.00

Category:

Description

5/5 - (4 votes)

As most of you are aware the physical location in which we exist (space) is gradually expanding.
Such a phenomena has had quite the impact in CS. I had a nice sequence of characters including
spaces and recently I have noticed that the runs of spaces within the string has expanded. Some
words within the sequence that were originally separated by one space are now separated by
many spaces.
To fix this problem (both now and in the future), I will only store the sequence of characters
without any spaces at all.
Input Specification
The input will begin with a non-negative, integer, n (n < 100,000), representing the number of characters in my current string (with expanded spaces). Following this will be a single space, followed by the n characters of the current string. Output Specification Output could contains the given sequence of characters with all spaces removed. Input Output Example Input Output 10 a b cd abcd 14 a Z x aab 81 aZxaab81 Explanation Case 1 The non-space characters in the first sequence are just “abcd”. For this reason the output contains just those 4 characters Note that the order in which the characters occur is important Case2 The non-space characters can include capital letters such as “Z” or numbers “81”. You need to handle both of them. Grading Information Read from standard input/output – 10 points. Good comments, whitespace, and variable names 15 – points Reads in all the input – 5 points No extra input/output (e.g. inputs prompts, “Please enter the number of characters:”) – 10 points Uses some method to check for space characters – 10 points Your program will be tested on 10 test cases – 5 points each No points will be awarded to programs that do not compile using gcc –std=gnu11 (gnu “eleven”). Sometimes a given technique will be requested, and solutions without it will have their maximum point totals reduced. For this problem there is no such required technique. Any case that causes your program to return a non-zero error return code will be treated as wrong. Additionally, any case that takes longer than the maximum allowed time (the max between {5 times my runtime, 10 seconds}) will also be treated as wrong. No partial credit will be awarded for a wrong case.