# Remove indentation [duplicate]

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


## marked as duplicate by DJMcMayhem♦ code-golf StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jan 3 at 22:56

• Hi! 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 Jan 3 at 21:24
• please 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 Jan 3 at 21:25
• Additionally, this looks very close to being a duplicate of codegolf.stackexchange.com/q/53219/42963 – AdmBorkBork Jan 3 at 21:26
• It 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 Jan 3 at 21:27
• @DJMcMayhem, thanks, I didn't know what the minimum proper question could be. – Mathieu CAROFF Jan 3 at 22:22

*.indent(*)