#K, 10 bytes
K, 10 bytes
~/1_'-':'=
Note this is a function, so it needs to be called:
~/1_'-':'="aaaaaabbbbbb"
1
~/1_'-':'="aba"
0
=
groups its arguments, so ="aaaaaabbbbbb"
produces "ab"!(0 1 2 3 4 5;6 7 8 9 10 11)
and ="aba"
returns "ab"!(0 2;,1)
-':'
is minus eachprior each. -':
is a good way to find out if a series is increasing (or decreasing). -':'="aaaaaabbbbbb"
gives us "ab"!(0 1 1 1 1 1;6 1 1 1 1 1)
and -':'="aba"
gives us "ab"!(0 2;,1)
1_'
is one drop each which pops the first element off each list.
~/
is match over.