Hackerrank “30 Days of Code” Çözümleri – Day 6: Let’s Review

Hackerrank’in 30 Days of Code içerisinde bulunan “Day 6: Let’s Review” sorusunun açıklaması ve çözümü. Bu soruda size verilen bir string‘in çift ve tek index’teki karakterlerini ayrı ayrı yazdırmanız isteniyor.

► Hackerrank 30 Days of Code Çözümleri – Day 6: Let’s Review: https://www.hackerrank.com/challenges/30-review-loop/problem

► Problem açıklaması:

Objective

Today we will expand our knowledge of strings, combining it with what we have already learned about loops. Check out the Tutorial tab for learning materials and an instructional video.

Task

Given a string, S, of length N that is indexed from 0 to N – 1, print its even-indexed and odd-indexed characters as 2 space-separated strings on a single line (see the Sample below for more detail).

Note: 0 is considered to be an even index.

Example

s = adbecf

Print abc def

Input Format

The first line contains an integer, T (the number of test cases).

Each line i of the T subsequent lines contain a string, S.

Output Format

For each String (where ), print ‘s even-indexed characters, followed by a space, followed by ‘s odd-indexed characters.

Sample Input

2

Hacker

Rank

Sample Output

Hce akr

Rn ak

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.