Your inputs are a string and an integer. Your output is the 2d matrix of strings achieved from adding 0
to N
spaces between each character and then deleting 0
to M
length segments (leaving one char before each segment) for each permutation of N
and M
up to the integer input. (eg, when N == M
you get back the original string)
Examples
Input of 0
, edge case
:
edge case
Input of 5
, abcdefghijklmnopqrstuvwxz
, one output per line, 'columns' of the 'matrix' separated with an extra newline for readability:
abcdefghijklmnopqrstuvwxz
a f k p u
a c e g i k m o q s u w z
a b c d e f g h i j k l m n o p q r s t u v w x z
a b c d e f g h i j k l m n o p q r s t u v w x z
a b c d e f g h i j k l m n o p q r s t u v w x z
a g m s z
abcdefghijklmnopqrstuvwxz
a e i m q u z
a d g j m p s v z
a c e g i k m o q s u w z
a b c d e f g h i j k l m n o p q r s t u v w x z
a d g j m p s v z
a f k p u
abcdefghijklmnopqrstuvwxz
a d g j m p s v z
a b c d e f g h i j k l m n o p q r s t u v w x z
a b c d e f g h i j k l m n o p q r s t u v w x z
acegikmoqsuwz
a f k p u
a e i m q u z
abcdefghijklmnopqrstuvwxz
a c e g i k m o q s u w z
a b c d e f g h i j k l m n o p q r s t u v w x z
adgjmpsvz
a f k p u
acegikmoqsuwz
a d g j m p s v z
abcdefghijklmnopqrstuvwxz
a b c d e f g h i j k l m n o p q r s t u v w x z
agmsz
afkpu
aeimquz
adgjmpsvz
acegikmoqsuwz
abcdefghijklmnopqrstuvwxz
Here's a pastebin of output for 59
, 1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~
Valid programs receive one integer and one string as input, and output (I+1)^2
strings corresponding to each permutation of N
and M
from 0
to I
. The order of the strings you output does not matter. Whitespace after the last printable character in each string also does not matter.
This is code-golf, so shortest answer in bytes per language wins.