Even-Move Replay Marker
Context
In the arcade game Neon Sprint, a replay is stored as a sequence of lowercase letters and spaces describing the moves a player made. The scoring engine keeps markers from moves at alternating positions to create a compact replay tag. You must retain the characters at even zero-based positions, leaving the original order unchanged.
Problem
Write a function that receives a replay string. Positions are counted from zero, so the first character is at position 0. Build and return a new string containing exactly the characters found at even positions: 0, 2, 4, and so on. Keep every retained character in its original order, including spaces. Do not modify the input string. If the replay is empty, return an empty string.
Examples
replay = "hello""hlo"replay = "move now""mv o"replay = "cat nap""ctnp"Constraints
0 <= len(replay) <= 120replay contains only lowercase letters and spaces.- Types:
replayis str; result is str
Function signature
def keep_even_move_markers(replay: str) -> str
replaystr- The replay text recorded by the player.
- returns str
- A string containing the characters from even zero-based positions of replay, in their original order.
Adapted from MBPP problem task_437 (CC BY 4.0). Rewritten, extended and verified by Iksha.