Problem:
Score : 200 points

Problem Statement

You are given a string S consisting of lowercase English letters.
We will write down this string, starting a new line after every w letters. Print the string obtained by concatenating the letters at the beginnings of these lines from top to bottom.

Constraints

1 \leq w \leq |S| \leq 1000

S consists of lowercase English letters.

w is an integer.

Input

Input is given from Standard Input in the following format:

S
w

Output

Print the desired string in one line.

Sample Input 1

abcdefgh
3

Sample Output 1

adg

When we write down abcdefgh, starting a new line after every three letters, we get the following:

abc

def

gh

Concatenating the letters at the beginnings of these lines, we obtain adg.

Sample Input 2

lllll
1

Sample Output 2

lllll

Sample Input 3

souuundhound
2

Sample Output 3

suudon

Solution in PHP (7.4.4) (judge verdict: Runtime Error)

<?php

// ファイルパス指定し、任意のファイルを読み取り専用でファイルオープン

$word = fgets(STDIN);
$word = trim($word);
$word_num = mb_strlen($word);

$num = fgets($file);
$arr = [];

for ($i = 0; $i < $word_num; $i++) {
  $tmp = substr($word, 0, 1);
  array_push($arr, $tmp);
  $word = substr($word, 1);
}

$ans_arr = [];

for ($i = 0; $i < $word_num; $i++) {
    if ($i === 0 || $i % $num === 0) {
        array_push($ans_arr, $arr[$i]);
    } 
}

$ans = implode("", $ans_arr);

echo $ans;

?>