# Find the syncopation

## Jelly, 12 9 bytes

=“e”µ<^\O


As a program, the above code requires quotes around the input. Since that is not allowed, this is a function submission. The output is 1-based. Try it online!

### How it works

=“e”µ<^\O    Monadic link. Argument: s (string)

=“e”         Check each character for equality with 'e'. Yields a Boolean array.
µ        Start a new, monadic chain.
^\     Compute the array of partial reductions by XOR, i. e., the parities
of all prefixes of the Boolean array.
<       Check if the Booleans are strictly smaller than the parities.
A truthy outcome indicates an off-beat quarter note.
O    Yield all indices of 1's.


### Update

The above code doesn't work anymore in the latest version of Jelly, since we need a character e, but “e” yields a string. Fixing that saves a byte, for a total of 8 bytes.

=”eµ<^\O


This works as a full program. Try it online!

## Ruby, 46

i=e=0
gets.bytes{|n|e^=n
e&4|n>114&&p(i)
i+=1}


Input to stdin. Output to stdout, newline separated.

Commented

i=e=0               #i keeps index, e keeps track of 8ths.
gets.bytes{|n|      #iterate through bytes in the input
e^=n                #xor e with input. We're interested in the 4's bit, which is only affected by ascii e, not ascii q
e&4|n>114&&p(i)     #e&4 evaluates to 4 or 0. OR with n and if the value is greater than ascii code for q, print index
i+=1}               #increment index


## JavaScript ES7, 50 48 bytes

Pretty short for JS, if you ask me. [for...of] syntax, basically combined map and filter, comes in handy for this challenge.

s=>[for(c of(i=f=0,s))if(++i&&c>'e'?f%2:f++&0)i]


Defines an anonymous function that outputs a 1-indexed array.

### Test snippet

This uses an ungolfed, un-ES7'd version of the code.

a = function(s) {   // Create a function a that takes in a parameter s and does these things:
var r = [],       // Set variable r to an empty array,
i = 0, f = 0;     // i to 0, and f to 0.
for(c of s) {     // For each character c in s:
i++;            //  Increment i by 1.
if(             //  If
c == 'q' ?    //   if c == 'q',
f%2 === 1 :   //    f is even; otherwise,
f++ && false) //    increment f and don't execute this:
r.push(i);    //   Add i to the end of r.
} return r;       // Return r.
}
<input type="text" value="eqqqe" id=O />
<button onclick="P.innerHTML='['+a(O.value)+']'">Try it</button>
<p id=P />