5 XP challenge

Make an Alternating Banner

very easy
Build it yourself · 3 min
1 Learn2 Predict3 Solve

Task
Your mission

Return pieces fragments alternating first, second, first, second, starting with first. Each fragment has 0 to 4 ASCII letters; pieces is 0 to 8.

Examples

InputReturn
first = "a", second = "b", pieces = 5

answer: "" → "a" → "ab" → "aba" → "abab" → "ababa". The result is "ababa".

"ababa"
first = "ab", second = "X", pieces = 4

answer: "" → "ab" → "abX" → "abXab" → "abXabX". The result is "abXabX".

"abXabX"

Your code

Write your answer inside Solution, then use return to send it back.

Try examples runs the public examples. Check my code checks your full answer and saves your completion.