Remove Spaces
Practice this coding question on Coding Gurukul.
Problem statement
A label maker receives text from a form where users sometimes insert extra spaces. The compact label must retain every letter and digit while removing the spaces. Your task Remove every ordinary space character from the input line. Important details This includes spaces at the beginning or end and runs of several spaces between characters. Keep the relative order and capitalization of all remaining characters. Do not remove digits or merge repeated letters. Read the complete line; stopping at the first space would lose part of the label. Worked example The line A B 12 C becomes AB12C. Both spaces between separate groups and repeated spaces are discarded.
Input format
One line containing English letters, digits, and spaces, with at least one non-space character.
Output format
Print the line with all spaces removed.
Constraints
1 <= line length <= 100000; spaces are ordinary ASCII spaces.
Sample input
A B 12 C
Sample output
AB12C
Sign in to run or submit a solution in C++, Java or Python.