5
05/11/2024 12:58 μμ
Εκκινητής θέματος
Write a program that takes 3 lines of characters and prints them in reversed order with a space between them.
Παραδείγματα:

3 Απαντήσεις
4
05/11/2024 12:59 μμ
Mine is with strrev string function (line #8):
<?php
$chars = '';
for ($i = 0; $i < 3; $i++) {
$chars .= readline()." ";
}
echo strrev($chars);
2
05/11/2024 1:00 μμ
My solution:
<?php $input1 = readline(); $input2 = readline(); $input3 = readline(); echo "$input3 $input2 $input1";
1
05/11/2024 1:01 μμ
Το δικό μου:
<?php
$chars = '';
for ($i = 0; $i < 3; $i++) {
$chars .= readline();
}
$output = '';
for ($i = 2; $i >= 0; $i--) {
$output .= $chars[$i] . " ";
}
echo $output;
