Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Comments on Weave Strings Together

Post

Weave Strings Together

+11
−0

Given a list of strings(and optionally, their length) as input, weave the strings together.

Intro

Your goal is to mimic the WV operator in Pip. Take a list of strings and alternate between their characters like so:

hello,
world, → hwc,eoo,lrd,lle,od → hwceoolrdlleod
code

Effectively, you need to group the characters at each index, and join them into a single string.

The strings may have spaces.

No truncation should be done, and all the characters of each string must be used.

Test Cases

Without the outputs

["kino","cinema","movie"] → kcmiionnvoeimea
["code","golf"] → cgoodlef
["Hi","","There"] → HTihere
["Explanation"] → Explanation
["Dyalog APL","Cultivation","Orchard"] → DCOyuralclthoiagvr adAtPiLon

You check any other test cases with this program.

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

General comments (5 comments)
General comments

Skipping 2 deleted comments.

Quintec‭ wrote over 3 years ago

Ugh, the "strings may have spaces" and the way you don't pad the strings makes it unusually annoying.

Shaggy‭ wrote over 3 years ago

Can we take the strings as an array of characters?

Razetime‭ wrote over 3 years ago

@Shaggy yes, you can

General Sebast1an‭ wrote over 2 years ago

Is it OK if the program sends an error but still outputs what you want? (This might have to be a Meta question or something.)

Razetime‭ wrote over 2 years ago

errors are ok as long as the correct output is on STDOUT.