# [dc], 39


Input string is read from STDIN and should be in the form `[yynynynynyyn]`.

dc is not known for its string handling, but we have just enough here to get this to work.  The approach here is to count the `n`s, and output `y` if even or `n` if odd.  This is done by executing the input string as a macro.  `dc` will output `'y' (0171) unimplemented` for all the `y`s and attempt to pop strings and print them for all the `n`s.  So first we make sure we have plenty (total input string length) of empty strings `[]` on the stack to pop.  Then we execute the input string and see how many `[]` are left on the stack.  The original string length is subtracted from this to give the (-ve) total number of `n`s.  The rest is arithmetic to do mod 2 and have the output come out right as ASCII `y` or `n`.

    ?dsi                                    # Read input string, duplicate, store in register i
        Zdsl                                # Get input length, duplicate, store in register l
            [         ]                     # define macro to:
             []                             #   push empty string
               r                            #   swap empty string and remaining length 
                1-                          #   subtract 1 from length
                  d0                        #   duplicate and compare with 0
                    <m                      #   if >0 recursively call this macro again
                       dsmx                 # duplicate macro, store in register m and execute
                           k                # discard left-over 0
                            lix             # load input string and execute as macro
                               z            # get stack length
                                ll-         # load string length and subract
                                   2%       # mod 2 (result is -ve because difference is -ve)
                                     B*     # multiply by 11 ('y' - 'n')
                                       C1+  # add 121 ('y')
                                          P # print result as ASCII char

[Try it online!][TIO-jhi0hjr2]

[dc]: https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html
[TIO-jhi0hjr2]: https://tio.run/##S0n@/98@pTgzKqU4Jzo6tshQN8XAJjc2pTi3Ijsns6IqJ0fXSNVJy9lQO@D//@jKyjworMyLBQA "dc – Try It Online"