My solution has 75 characters, damn, I will have another look at it! to answer ari's questions: > case s > when s + 1 == y and s - 1 == q try this: case when s+1==y && s-1==q > also, modulus is x % y, right? yes