1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
●コメント版
+[>                        # while ({0})  do
  +>,<                     #   {1} = 1 ; {2} = getchar()
  >                        # ** dollar check **
   >>++++++[-<++++++>]<<   #   {3} = 36 dollar
                           # ** compare {3} & {4} **
   [->>+>+<<<]             #   {@2:@3} = !{@0}
   >>>[-<<<+>>>]<<<        #   {@0} = !{@3}
   >[->->+<<]<             #   {@2} = {@2} minus {@1} ; {@3} = !{@1}
   >>>[-<<+>>]<<<          #   {@1} = !{@3}
   >>
   >+<[[-]>-<]>[-<+>]<     # ** invert result **
   [[-]<<[-]<[-]<[-]>>>>]  #   {2:1:0} = 0
   <[-]>                   #   {3} = 0
   <<
  <
  [>                       # ** count up if input char is not dollar **
   [->>>>>>+<<<<<<]        #   {8} = !{2}
   >>>>[-]>[-]>            #   {6:7} = 0 ; move to {8}
   [- [->>+<<]+>> ]        # ** extend arm to {8 plus (charcode times 2)} **
   >+<                     # ** count up **
   <<[[-]<<]               # ** reduce arm **
   <<<<
   [-]<[-]>                #   {2:1} = 0
  <]
<]                         # end   ** next char **
# show result
>>>>>>>> >>+
[
  >[[-<.>]++++++++++.[-]]<
  [->>+<<]>>+
]

●コメントなし版
+[>+>,<>>>++++++[-<++++++>]<<[->>+>+<<<]>>>[-<<<+>>>]<<<>[->->+<<]<>>>[-<<+>>]<<<>>>+<[[-]>-<]>[-<+>]<[[-]<<[-]<[-]<[-]>>>>]<[-]><<<[>[->>>>>>+<<<<<<]>>>>[-]>[-]>[-[->>+<<]+>>]>+<<<[[-]<<]<<<<[-]<[-]><]<]>>>>>>>>>>+[>[[-<.>]++++++++++.[-]]<[->>+<<]>>+]