Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $line = array_map('intval', explode(' ', readline()));
- $input = readline();
- while ($input !== 'end') {
- $number = intval($input);
- if (strlen($input) === 1) {
- array_splice($line, $number, 0, $number);
- } else {
- $index = substr($input, 0, (strlen($input) - 1) * -1);
- array_splice($line, intval($index), 0, $number);
- }
- $input = readline();
- }
- echo implode(' ', $line);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement