0
Write a program which removes any common leading spaces from the input string. For example, if the least indented line started with 3 spaces, and every other line has >=
3 leading spaces, then remove 3 spaces from the beginning of each line.
The indentation consists solely of spaces, and the string will not contain any tabulation. This is the same as the textwrap.dedent
function in python.
Example (input, output):
Input
7aeiou
3b
555
Output
7aeiou
3b
555
Input
this
is
a
test
Output
this
is
a
test
Input
Hello
world
Output
Hello
world
2Hi! I'm not familiar with Python. Can you explain what the
dedent
function does, so we can replicate it without needing to know Python? Thanks! – AdmBorkBork – 2019-01-03T21:24:54.7231please don't override PPCG's default submission guidelines. It's usually perfectly fine to submit functions without calling them, and allowing input as a predefined variable just turns submissions into snippets – Jo King – 2019-01-03T21:25:59.577
3
Additionally, this looks very close to being a duplicate of https://codegolf.stackexchange.com/q/53219/42963
– AdmBorkBork – 2019-01-03T21:26:05.997It seems that example text looses 3 leading spaces on each line? Is this what the task is? May we assume that input always has at least 3 spaces on each line? May we assume a variable to hold a list of strings if this is more natural to our language? – Adám – 2019-01-03T21:27:07.703
@DJMcMayhem, thanks, I didn't know what the minimum proper question could be. – Mathieu CAROFF – 2019-01-03T22:22:06.833