[Question]
  [
## A Brainfuck derivative
Let's define a simple [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck)-like programming language.
It has a two-directional tape of cells, and each cell holds one bit.
All bits are initially 0.
There is a moving head on the tape, initially at position 0.
A program is a string over the characters `<>01!`, executed from left to right, with the following semantics:
* `<` moves the head one step to the left.
* `>` moves the head one step to the right.
* `0` puts 0 in the current cell.
* `1` puts 1 in the current cell.
* `!` flips the current cell.
There are no loops, so a program of **n** characters terminates after exactly **n** steps.
A program is *boring* if all cells contain 0 at the end of execution, and *exciting* if there is at least one 1.
Note that the size of the tape is not specified, so depending on the implementation, it may be two-way infinite or circular.
## An example program
Consider the program `1>>>!<<<<0>!>>>!`.
On an infinite tape, execution proceeds as follows:
```
     v
00000000000000  Put 1
     v
00000100000000  Move by >>>
        v
00000100000000  Flip
        v
00000100100000  Move by <<<<
    v
00000100100000  Put 0
    v
00000100100000  Move by >
     v
00000100100000  Flip
     v
00000000100000  Move by >>>
        v
00000000100000  Flip
        v
00000000000000
```
At the end, all cells are 0, so this program is boring.
Now, let's run the same program on a circular tape of length 4.
```
v
0000  Put 1
v
1000  Move by >>>
   v
1000  Flip
   v
1001  Move by <<<< (wrapping around at the edge)
   v
1001  Put 0
   v
1000  Move by > (wrapping back)
v
1000  Flip
v
0000  Move by >>>
   v
0000  Flip
   v
0001
```
This time, there is a cell with value 1, so the program is exciting!
We see that whether a program is boring or exciting depends on the size of the tape.
## The task
Your input is a non-empty string over `<>01!` that represents a program in the above programming language.
An array of characters is also an acceptable input format.
The program is guaranteed to be boring when run on an infinite tape.
Your output shall be the list of tape lengths on which the program is exciting.
Note that you only need to test the program on tapes that are shorter than the program length.
The solution with the lowest byte count in each language is the winner.
Standard [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") rules apply.
## Test cases
```
> : []
110 : []
1>0<! : [1]
0>>1>0<<>! : [1]
1>>>!<<<<0>!>>>! : [2, 4]
!<!<><<0>!>!<><1!>>0 : [2]
>>!>><>001>0<1!<<!>< : [1, 2, 3]
1!><<!<<<!!100><>>>! : [1, 3]
!!1>!>11!1>>0<1!0<!<1><!0<!<0> : [3, 4]
<><<>>!<!!<<<!0!!!><<>0>>>>!>> : [1, 2, 4]
0>>><!<1><<<0>!>>!<<!!00>!<>!0 : [3]
0000!!!!><1<><>>0<1><<><<>>!<< : []
!>!>!>!>!>1>!>0<!<!<!<0<!<0<!<!<!<1>!>0<<! : [1, 2, 5, 7]
<!!>!!><<1<>>>!0>>>0!<!>1!<1!!><<>><0<<!>><<!<<!>< : [1, 2, 4, 5]
!>1<<11<1>!>!1!>>>0!!>!><!!00<><<<0<<>0<<!<<<>>!!> : [1, 2, 3, 5, 6]
```
  
[Answer]
## Haskell, 119 bytes
```
t#'<'=last t:init t
(h:t)#c|c<'#'=1-h:t|c>'='=t++[h]|1<2=read[c]:t
f p=[n|n<-[1..length p],sum(foldl(#)(0<$[1..n])p)>0]
```
[Try it online!](https://tio.run/##VYxLDoMwDET3nMKBSgHRVnGXyPFFUBaIT0FNUwTpjrtTw66S5bE9fjM266v3ft9jpklb36wRYjWFSSTJxyoWWbu1pDNt8Sbr1rK22sayrEe3IT3s0jdd3boqJgPMtg5boFuN97vvwzOOMLvr@n3nw8d3Ps@K3NDlcIMr5oKN29/NFMBC90kA5mUKES4wQEpKsRQREjMrI80oUoyK8LwzkyE5yKgOpfQ/QF4FRkKWIFQnLxNLsDEk1IGzOWkJEy9N9h8 "Haskell – Try It Online")
Function `#` is the interpreter for a single command `c`. The whole program `p` is run by `fold`ing `#` with the starting tape into `p`. `f` executes `p` for every tape and keeps those where the sum of the cells is at least 1. 
[Answer]
# [Stax](https://github.com/tomtheisen/stax), ~~56~~ ~~54~~ ~~43~~ ~~38~~ 35 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)CP437
```
è¥%►BΣ░ÜY⌂y(â&.═ªê►V½▲y▌)▀♫♂╣ª?√»!#
```
42 bytes when unpacked,
```
%fz(y{{|(}{|)}{B!s+}{0_]e&}4ls"><! "I@!F|a
```
[Run and debug online!](https://staxlang.xyz/#c=%C3%A8%C2%A5%25%E2%96%BAB%CE%A3%E2%96%91%C3%9CY%E2%8C%82y%28%C3%A2%26.%E2%95%90%C2%AA%C3%AA%E2%96%BAV%C2%BD%E2%96%B2y%E2%96%8C%29%E2%96%80%E2%99%AB%E2%99%82%E2%95%A3%C2%AA%3F%E2%88%9A%C2%BB%21%23&i=%3E%0A110%0A1%3E0%3C%21%0A0%3E%3E1%3E0%3C%3C%3E%21%0A1%3E%3E%3E%21%3C%3C%3C%3C0%3E%21%3E%3E%3E%21%0A%21%3C%21%3C%3E%3C%3C0%3E%21%3E%21%3C%3E%3C1%21%3E%3E0%0A%3E%3E%21%3E%3E%3C%3E001%3E0%3C1%21%3C%3C%21%3E%3C%0A1%21%3E%3C%3C%21%3C%3C%3C%21%21100%3E%3C%3E%3E%3E%21%0A%21%211%3E%21%3E11%211%3E%3E0%3C1%210%3C%21%3C1%3E%3C%210%3C%21%3C0%3E%0A%3C%3E%3C%3C%3E%3E%21%3C%21%21%3C%3C%3C%210%21%21%21%3E%3C%3C%3E0%3E%3E%3E%3E%21%3E%3E%0A0%3E%3E%3E%3C%21%3C1%3E%3C%3C%3C0%3E%21%3E%3E%21%3C%3C%21%2100%3E%21%3C%3E%210%0A0000%21%21%21%21%3E%3C1%3C%3E%3C%3E%3E0%3C1%3E%3C%3C%3E%3C%3C%3E%3E%21%3C%3C%0A%21%3E%21%3E%21%3E%21%3E%21%3E1%3E%21%3E0%3C%21%3C%21%3C%21%3C0%3C%21%3C0%3C%21%3C%21%3C%21%3C1%3E%21%3E0%3C%3C%21%0A%3C%21%21%3E%21%21%3E%3C%3C1%3C%3E%3E%3E%210%3E%3E%3E0%21%3C%21%3E1%21%3C1%21%21%3E%3C%3C%3E%3E%3C0%3C%3C%21%3E%3E%3C%3C%21%3C%3C%21%3E%3C%0A%21%3E1%3C%3C11%3C1%3E%21%3E%211%21%3E%3E%3E0%21%21%3E%21%3E%3C%21%2100%3C%3E%3C%3C%3C0%3C%3C%3E0%3C%3C%21%3C%3C%3C%3E%3E%21%21%3E&a=1&m=2)
-2 bytes per comment by @recursive
## Explanation
I will use the version with a prefix `i`(i.e. `i%fz(y{{|(}{|)}{B!s+}{0_]e&}4ls"><! "I@!F|a`) to explain and I will explain why the `i` can be removed
```
i               Suppress implicit eval
                    This prevents the test case "110" from being interpreted as a number
                    However, this can be removed because a program containing only numbers cannot be exciting and the output will be empty anyway.
                    This is based on the fact that the program is boring on non-circular tapes
 %f             Filter range [1..n] with the rest of this program
                    Where n is the length of the input
                    Implicit output the array after filtering, one element per line
   z(           Initialize the tape
     y{  F      Run the program
          |a    Any cell is non-zero
```
Code for running the program:
```
{|(}                                 Block to rotate left by one element
    {|)}                             Block to rotate right by one element
        {B!s+}                       Block to perform logical not on the element at index 0
              {0_]e&}                Block to obtain current instruction,
                                         Convert it to a number
                                         And assign to element at index 0
                
                     4l              Pack the 4 blocks in an array
                       s"<>! "I      Find the index of current instruction in string, if not found, the index will be -1
                                         And when indexed with -1, it wraps around to the 4th element.
                                 
                               @!    And execute the corresponding block.
                                    
```
[Answer]
# [CJam](https://sourceforge.net/p/cjam), ~~57~~ ~~56~~ ~~49~~ 46 bytes
-7 thanks to @MartinEnder
```
{:T,({)0a*T{i23%")!+(+ W0tW1t)\+"3/=~}/:+},:)}
```
[Try it online!](https://tio.run/##NVDLasNADLzvV1SBQFwHLDU3o8wn5BTIpZfQUwuFFnIzzq@7M7K7i1l5NS/tx9f9e/m9DMs0Xo@HqfP763X6fDvtd531h/7l5o9bPLr3fncazs95GPv5OHbzsh9/FrSApzUHVCSMF4All8NUNktLrL8qgrfeoGbCXbQg3pCNLRakmoU720W3IDaCR0Fpl4Gs09EkLUMrnptJA8xTDgqGlbAFkpVRnFHMm3NZcSLl54XcJLMZ/rcyyFHbt89KWPd8AaqivKNiy9cJAGeLNRNSQKwjalw2CY/SMD0LGfKqgFmJNcr6JJD6Hw "CJam – Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/), ~~83~~ ~~82~~ ~~79~~ 77 bytes
Includes `+3` for `-F`
Give instructions as one line on STDIN
```
#!/usr/bin/perl -F
1~~@$m&&say$m until++$m>map{*r=\$$m[($n+=/>/-/</)%$m];$r=/\d/?$&:$r^/!/}@F
```
[Try it online!](https://tio.run/##HYhBCsIwEEWv4sAY1BInWXRTp2NX3XkCq1DQRaFJS1oXIvboxig8/vu88R76PEa7LBU6pab2iW718HPXZxk6ce342oWyQXTnDfqsJCFNTNs1ussBQ0nNjY6oCgxXAnpXdYwMIAlmyyICJo0BBrHA9t9F2HAK6cLP/BnGuRv8FPUp3xtroq6/ "Perl 5 – Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/) (`-F`), 101 bytes
```
map{$,=@a=(0)x$_;map{$,+=/>/-/</;$a[$,%@a]=$&if/0|1/;$a[$,%@a]=!$a[$,%@a]if/!/}@F;say if@a~~/1/}1..@F
```
[Try it online!](https://tio.run/##TcvBSgMxEAbge58i06ai2GySQ087O@S0N59ARIaS0i3qhk0WFNs@ujGxIJ3L//PNTPDT2zbndw7fctM57u7Nw6d8ba/w2GnSSqNuJT/LzdrxSyfvhr02J3tr8F/LDvTZ9W3kLzHsHV8u2uqzbRrX54pLpdSyFStxnGMSBz95kUYRfeCJU@m@6I6jF@OcwpxiRkIkAgRARDAAUMFQGSBaFKc/sliluinHZAHt9ZTQlMcSCDXxZwxpGD9iVk/bxliTVf8L "Perl 5 – Try It Online")
[Answer]
# [Red](http://www.red-lang.org), 243 bytes
```
func[p][repeat n length? p[b: copy[]insert/dup b 0 n i: 1
parse p[any["<"(i: i - 1 if i < 1[i: n])|">"(i: i + 1 if i > n[i: 1])|"0"(b/(i): 0)|"1"(b/(i): 1)|"!"(b/(i): either b/(i) = 0[1][0])|
skip]]s: 0 foreach c b[s: s + c]if s > 0[print n]]]
```
[Try it online!](https://tio.run/##bVG7bsMwDNzzFaSnFEUQcg1U9h@6ChoSR26MFo5hp0OB/nt6lJMOjSwY4vvuqCkfr2/5SDFRt7t2X0MbxxSnPOb9hQb6zMP75fRKYzzsqD2P3zH1w5yny/b4NdKBBDX9jnQ17qc5o2w/fMcmNGsEe9qQUt/BCKQRkSE9/TR2Sz7fk0aDJ9WT0qwP23X/tCOBp3@ewuM/L/eXU56oePRCEjVFQftq/ujHlGZ0U3ee8r49UUuHiMAMvDYBbwaexHHqB@hLKV0Xs9lsNs2qIwK/1f@QmgR@DIuZZ4JxrcWMAz4xdvOxggMHW/JuKMrkscq8PZiIIykmsoUKGqLB4ZhVBPV1RFZMU8VVhkFUUAvllopsp@cquEwWZkcxqC6kqvuwZeRNttNl8IE@rmgTfFymanDOUlpvoBWVbPfjOpy1H7n9XKA9XnsrELHCX8tynKqgw7BSXXRZ8E5bFlndMqrRrwWF/b0wwtkUkaGo9v0sL2EO11x/AQ "Red – Try It Online")
Prety verbose and straightforward implementation. Red's 1-indexing doesn't allow me to reduce the byte count by using modular arithmetic for looping through the circular tapes.
Ungolfed
```
f: func[p][ 
    repeat n length? p[
        b: [] 
        insert/dup b 0 n
        i: 1
        parse p[
            some [
                 "<" (i: i - 1 if i < 1[i: n])
               | ">" (i: i + 1 if i > n[i: 1])
               | "0" (b/(i): 0)
               | "1" (b/(i): 1)
               | "!" (b/(i): either b/(i) = 0 [1][0])
               | skip 
            ]
        ]
        s: 0
        foreach c b[s: s + c]
        if s > 0 [print n]
    ]
]
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~139~~ ~~135~~ ~~133~~ ~~132~~ 131 bytes
-3 bytes thanks to Mr. Xcoder  
```
def f(p):i=0;exec"i+=1;s=[0]*i\nfor c in p:c=ord(c)-61;s=c>-2and s[c:]+s[:c]or[[s.pop(0)^1,0,1][c%7]]+s\nif 1in s:print i\n"*len(p)
```
[Try it online!](https://tio.run/##VZL/aoNADMf/31NcBsO2cyNpuw7smRe53mBYZcJQUQfb03dJzu6HIt4luW8@yWX4mt/6bnu5nOvGNathXbQlHuvPurpt70s6TmXAuGlPXdOPrnJt54aiKvvxvKrWDwf1V/ywfe3ObgpVEe@nUFSxH0OYHod@WOH6hXLMKYbq7jmK@9S1jSORmYphbLvZifTt5r3uJPVlrqd5cqULIeMsdyHGPGTE6EF3ZFtkVovnPzZiZvDyIIMu1bPN3d6c4MFzcumCJAItwLysJzwjqiiJCLA34dyJwi7Ji82rPgAhSvSSgq4BYhcZIvmZigB7Ym9/tEp2VxpFUVgwPQRQbZaiDOQ38/5aLCetpTYFBGGQSsCqSAAoD5gWeeVDO7Kk8j@tBL6@yqt0@uLygWVSu4dfkKfcPSdykTdasgYoGsoRlqZRqoK9HuXUrH993IvOQkAiQJYH9CpEQ3msKm9lajtSu1nz/bkMgznEGG9udBp1WnI31tPH@6yDmaancGmudHdMyxRybFZqWydjduqyyzc "Python 2 – Try It Online")
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 121 bytes
```
.+
$.&*0¶$&
\G0
0$`¶
{ms`^.(?=.*¶¶(0|1))
$1
"¶¶!"&mT`d`10`^.
"¶¶>"&`(.)(.*)¶
$2$1¶
"¶¶<"&`(.*)(.)¶
$2$1¶
)`¶¶.
¶¶
G`1
%`.
```
[Try it online!](https://tio.run/##Tcs7DsIwDADQ3bdIZKIkSJbNXMLYC3REyEgwMJQBusG5coBcLE3Kggf/nv26L4/nVWqlPSC5yCWjg/PIwKglw2d@64X86Uix5JI9fyUEQAHbR2PdPOlNhdvRb5WsU0/BUwztHQ8orWwybBIb/UnQTgQ9w6gCO6VaJaVkhhacTG9X "Retina – Try It Online") Explanation:
```
.+
$.&*0¶$&
\G0
0$`¶
```
Create an array of tapes of each length up to the length of the input program.
```
{
```
Loop until the program is consumed.
```
ms`^.(?=.*¶¶(0|1))
$1
```
If the next character in the program is a 0 or 1, change the first character on each line to that character.
```
"¶¶!"&mT`d`10`^.
```
If it is a `!` then toggle the first character on each line.
```
"¶¶>"&`(.)(.*)¶
$2$1¶
"¶¶<"&`(.*)(.)¶
$2$1¶
```
If it is a `>` or `<` then rotate the line. (Easier than moving the head.)
```
)`¶¶.
¶¶
```
Delete the instruction and end the loop.
```
G`1
```
Keep only the exciting lines.
```
%`.
```
Count the length of each line.
[Answer]
# JavaScript (ES6), ~~126~~ 118 bytes
*Saved 3 bytes thanks to @user71546*
Takes input as an array of 1-character strings.
```
f=(s,l=0,p=0,t=[])=>s[l++]?s.map(c=>1/c?t[p%l]=+c:c>'='?p++:c>';'?p+=l-1:t[p%l]^=1)&&+t.join``?[l,...f(s,l)]:f(s,l):[]
```
[Try it online!](https://tio.run/##hZJhT4MwEIa/@yu4Dw4IjPXc1ATb44eQGhfczBYcRIh/H@/ajTgFhZA223t3z/u2x@3ntqs@Dm2/PDWvu2HYm6hLa6PSlr/elDY21JV1ktiiy963bVQZwlVV9GV7W1uTVHlFoQmLNklk9yQ7Uy8x94Jng/FikfTZsTmcXl6Ksk6zLNvLjNjmfs1LO1TNqWvqXVY3b9E@KlkTUmjjOFitSnsz8S@S0nBR4KREEYlK0z86JCLQ/CgC2V7Ud2mwmSwADZq8XDbIVWosmqwg6axJKQFCHgakR6g04EnraTTWaWEDQKW4wzc8nCtiLY9D5MVN46A0knarGlNdz7kTaxIIuLkKQBiIw3Qmrqk3c8GTn3nOVAwD83NaMCY1Da/4ATcTtfhVrs0ZSf95JYAur/gXt/Kq8weOSH7XcG3iPg0ep5NgDOceXfBiS3Eb4gNEnwppaUf@kH6d6YZ7z5AiN0XHA3J9uK9wu5S0i00i90dPwvDjsjjoBzt8AQ "JavaScript (Node.js) – Try It Online")
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~79~~ ~~64~~ 54 bytes ([Adám's SBCS](https://github.com/abrudz/SBCS))
```
⍸⊂{∨/⍎⍕(↓',',⍨5 3⍴'0@11@1~@1 1⌽¯1⌽')['01!<'⍳⌽⍺]⍵}¨0=,\
```
[Try it online!](https://tio.run/##rVCxSgRBDO39ik01CismiF0MV1toYakWB3I2B9qKaGFxiDiHIPcP21moIILNfUp@ZM3LrvgDzjCb2czLey@ZXs23z6@n88uLvvf66Y/3N/7Q7Xhdel1t@uKltKX12u01u17fC09EJnI3kUb86Xv9im/ZOikspMXrW/x6/Trz@nG77ni/Pe37WeOL5@b/uNs/8g1frg6Ojw7XXTOLU6w0RYyVIrIZrmqUSTPSWGyEa6RISW1I4CKR50gbAGrMKA5hJVMQRFAwEAlzAEYSksCLREh4SKuYZmS4gQSkKWuZCDwW3lJnsGlD0WgOkhQSYYpgiGNR1olClxM70sIa2e@GFyhj83goyZHPqQS3pQfJFqDOAbHoVAZvpoDa0O7QfDxHgSQPYVBRA700qukcTQ0DMvCXHw "APL (Dyalog Unicode) – Try It Online")
-15 thanks to [Adám](https://codegolf.stackexchange.com/users/43319/ad%c3%a1m) (forgot about monadic `⍸`).  
-10 thanks to [ngn](https://codegolf.stackexchange.com/users/24908/ngn).
[Answer]
# [MATL](https://github.com/lmendo/MATL), ~~46~~ 39 bytes
```
f"@:~G"@59>?@61-YS}@33=?t1)~}@U]1(]]a?@
```
[Try it online!](https://tio.run/##DckxCoAwEETRs2watRCyBAVlnGznAcTCIoWNlXZp9eoxxYcH/znzXcrlbP5WZ8PEaKP2x/ZaCEvM2n2v7UnblM5opTRCBVShFIoKSS9VhIj3IAAPsCaVZH3NDw) Or [verify all test cases](https://tio.run/##NVC7TgNBDOz5C6dZKE6yFYEEMnNbUKUFpFCcRBoq0qVNfv2Y8R67Otnyzct7Pl1@1@/jYf3Z9ZfbYdcfnzH3p5i@3q99v3@dL/Fwu/bPJe6X5TT3dVnaNLXj28fa0O5awNNYHVCbsBoCljwOU8uRpSXGQE1w7hxDgIS7yEGOISXAklIwC3cCNhEL4iNYCk7rDGRVVxpZyNqK62bSAbOVz4iJQdrCydJowVCmQM5jxYuUrxd2k1U0w/9VFjnr@vZZiWter0JtVIaoFeTuhICbxsiGFBRj3bE8f5MQpWN6KHLkV0Gzkmup8UCQfvsD).
### How it works
```
f             % Push indices of nonzero chars of (implicit) input string: gives
              % [1 2 ... n] where n is input length
"             % For each k in [1 2 ... n]. These are the possible tape lengths
  @:~         %   Push array of k zeros. This is the tape, in its initial state
  G           %   Push input string
  "           %   For each char in the input string
    @59>?     %     If code point of current char exceeds 59 (so it is '<' or '>')
      @61-    %       Push code point minus 61: gives -1 for '<', or 1 for '>'
      YS      %       Circularly shift the tape by that amount. Instead of moving
              %       the head, we shift the tape and keep the head at entry 1
    }         %     Else
      @33=?   %       If code point of current char is 33 (so it is '!')
        t1)   %         Duplicate the array representing the tape, and get its
              %         first entry
        ~     %         Logical negate
      }       %       Else
        @U    %         Push current char (it is '0' or '1') converted to number
      ]       %       End
      1(      %       Write (either 0, 1 or old value negated) at entry 1
    ]         %     End
  ]           %   End
  a?          %   If the tape contains at least a nonzero value
    @         %     Push tape length, k
              %   End (implicit)
              % End (implicit)
              % Display (implicit)
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~192~~ 78 bytes
```
⊂{t/⍵⊣⍵{t[m]←('01!'⍳⍵)⊃0 1,e,⍨~e←t[m←⍺|i⊣i+←¯1 1 0⊃⍨'<>'⍳⍵]}¨⍺⊣i←⊃t←⍬⍳⍺}¨1+⍳∘≢
```
[Try it online! (non-flattened result)](https://tio.run/##NVC9SgNBEH6Vm2oTTOJMvw5ItBD8KaKFiEXEiwRiInqFErVQET05sRGstUkRsBCblHmUfZH4zd55x93Oznx/u92zQfP4qjsYnSxq4fV9uxOKab0VileHXXvfuYvuIHMuvDxg31lv7bW31rB9fDsaXSajXi9p9lZGw6SZrWTnaYpJ/pUOu0eDtLO6uWusYlqRN3bA4sUCPvndOFsOxS/A@I@zg9NDzGqOhVwoftCrh/yeE2mkjVBMblNMAcI/FLPrfsg/UfaX5t@SSMKAAuS8VtzDm/kEOIj3jZHfZ5E4jdMZhrJk5dNHeP6szyeN@cSpS5woe8LKqlZ6pdhUJY@HlaxEizx5LRtWCPqMthrAK7ORBRxSbwJYvCkQCTMAlQgJ8CJYIhzWXtTHlS2NWZg1RS4TmY4iW/QpY2pJqsKZJcECocgCMR6KPPHmyxFbyVo00v/XspizvVx9FMWtH28F2hozSDyCuTMgipNKmU29QbU8bnl4jEGQqEN2UeCYXwzqY3I7VHlBavruDw "APL (Dyalog Unicode) – Try It Online")
[Try it online! (flattened)](https://tio.run/##NVA7SwNBEP4rN9UmJNGZfh0QtRB8FNFCJEWCFwlEI3qF4qMwInpywUaw1iZFwEJsLPNT9o/Eb/bOO@52duZ77XbPhq2jq@5wdLyohcnbTjsUs/pSKCYOu7UD5y66w8y58PKAfXtjaX9tex3bx9fe6DIZ9ftJq78yOk1a2Up2nqaY5J/pabc3TNurW3vGKmYVeXMXLF4sFuEpr4X8/jpbDsUP8PhfZ4cnHYxrjoVcKL7Rq4d8zIk002YopncppgDhH4rfm0HIP1AOGvMvSSRhQAFyXitu53Y@BQ7iA2Pk4ywSZ3H6i6E0rHx6D88f9fm0OZ86dYkTZU9YWdVKrxSbquTxsJKVaJEnr2XDCkGf0VYDeGU2soBD6k0AizcFImEGoBIhAV4ES4TD2ov6uLKlMQuzpshlItNRZIs@ZUwtSVU4syRYIBRZIMZDkSfefDliK1mLRvr/WhZztperj6K49eOtQFtjBolHMHcGRHFSKbOpN6iWxy0PjzEIEnXILgoc84tBfUxuhyovSE3f/QE)
~~After some time spent banging my head against the wall, I decided to make a Tradfn instead of a Dfn. This is the result. Smarter people than me may be able to golf the heck out of this.~~
Surprise, surprise, someone smarter than me *did* golf the heck out of this. Thank you Adám for 114 bytes.
He said:
> 
> Notice that it is your exact program, except using indexing instead of the inner :Ifs and collapsing :For-loops to {\_}¨ while giving a left argument to replace the global.
> 
> 
> 
The function assumes `⎕IO←0`.
---
### How?
(This explanation uses an "ungolfed" version to facilitate reading)
```
⊂{                                  ⍝ Enclose
      i←⊃t←⍬⍳⍺                      ⍝ Assign a vector of 0s to t (the tape), then assign the first 0 to i.
      t/⍵⊣⍵{                        ⍝ Use ⍵ as left argument for the nested function, then compress the result into t. If there is a 1 anywhere in t, the result will be a vector of the result. If not, the result is an empty vector.
          i+←¯1 1 0⊃⍨'<>'⍳⍵         ⍝ Map the string '<>' to the argument (which is the BF program). That yields 0 for <, 1 for >, and 2 for anything else.
                                    ⍝ The resulting vector will then be used as the argument for ⊃ to add -1 (index 0), 1 (index 1) or 0 (index 2) to the variable i.
          e←t[m←⍺|i]                ⍝ Assign i mod ⍺ (left arg) to m, and use it to index t. Then, assign the value to e.
          t[m]←('01!'⍳⍵)⊃0 1,e,⍨~e  ⍝ Map the string '01!' to ⍵. As before, this yields 0 for 0, 1 for 1, 2 for ! and 3 for anything else.
                                    ⍝ Then, concatenate (not e) with e, then concatenate that with the vector 0 1. This is used as argument to be picked from, and it is assigned to t[m].
      }¨⍺                           ⍝ Do that for each argument
  }¨1+⍳∘≢                           ⍝ And do that for each possible tape length from 1 to the length of the input.
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 41 bytes
```
JR0ṁð3“1⁺¦01¦¬1¦ṙ1 ṙ- ”s“10!<>”,yẎvÐ€⁸Ẹ€T
```
[Try it online!](https://tio.run/##FckxCsJAEIXhq2R6AzPYDu8AluIVbCSdIKTL2tiJWClomypFyuyWu@QguxdZx@L9fPBOx67ra93tOXuX5m0ZPlJciCNLHONkyf4tjaVtyvA9/38mhXnT53C/pEe5TsUtOSyGQ0239Zn9q1aCqIqogEBCAJhMUCJmhaqyKmxkBOz7AQ "Jelly – Try It Online")
[Answer]
# [C (clang)](http://clang.llvm.org/), 171 bytes
```
l,i;f(S){for(char*p,t[l=strlen(S)];l;memchr(t,1,l)&&printf("%d ",l),l--)for(memset(t,i=0,l),p=S;*p;p++)*p==60?i=i?i-1:l-1:*p==62?i=i^l-1?i+1:0:*p^33?t[i]=*p-48:(t[i]^=1);}
```
[Try it online!](https://tio.run/##TZFhb4JADIY/y6@gJDMHQtJuy7LIUX@EH40mxqm7BB0Bti/Lfrtri6IQcr1e37fPlV2xq7fn4@VS56E8uGX6e/hq3e5z22ZN3q/qquvben@Wg3VZl6f9affZuj6nvE6n06YN5/7gkqePOJFEXhdFqnIp6/a9lIUKNd9UyzJrymY2S7Omqt5wEaqwCAXNa/ks9aypjWwXYUZzlOTm5WXRr8K6ypri9X3uNN5UlJZ/l5@v8BEfjTLOujT6jSYjShfP41WSx11aRpODs6X57juXrBOJ/6JICuPTNpydCY8uYT3QgAjHkNHDbYPMuvcM92Nm8PIgg4a3PHjwPGQ1IDkcLVlLPSOqF4ka2I9@Ens1BCBEqXr0BBIlkSwmFDBP7G3FkV3bKhOYCwKoIwu5tX24CQ/yK7pigHQUWhhJUR4wB/LKgia4NhiZgW@v8imNvnj9wNpo/j5HacXGRXZBhUGpYxkGDbzstZ6HYTzMR2pEReYIOlURameD93Ybve0wQ9Ym9rMv/w "C (clang) – Try It Online")
Had to use clang, since using `char*p,t[l=strlen(S)]` as the initialisation expression for some reason makes GCC think I want to declare `strlen` instead of calling it.
Pretty straight-forward: Runs the program on circular tapes of decreasing length, outputting any length that resulted in a 1 somewhere on the tape.
Tried shortening the tangle of the ternary operators, but ended up needing more parenthesis than was healthy.
]