Zigzag Bytes

A challenge by MeWhenI avatar MeWhenI

Description

A string zigzags if its bytes go up, then down, then up, then down again, and so on…

Note that a zigzag can start with a zig or a zag (an increase or a decrease).

Here are some strings that zigzag:

1212
2121
xyxyx
13254
SwApCaSeFuNnY
z!g zag >:^)

Here are some strings that don’t zigzag:

1232
1221
zigzag
!!!!!!

Write a program which outputs all lines from the input which zigzag. Your program must also zigzag.

NOTE: Each line will consist of 4-50 bytes of printable ASCII.

Leaderboard

Author Bytes
No solutions yet
Challenge ended 31 December 2025 ago
This challenge has ended. You are free to submit more solutions but they won't count for scoring.