blob: e83693351990fd854bdb17c42b5e69598f82221c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
use v5.36;
sub task2 ( $word ) {
my @c = split '', $word;
my @k = grep { $c[$_] =~ /[aeiou]/i } keys @c;
@c[@k] = reverse @c[@k];
return ucfirst lc join '', @c;
}
my @tests = (
[ qw<Raku Ruka> ],
[ qw<Perl Perl> ],
[ qw<Julia Jaliu> ],
[ qw<Uiua Auiu> ],
[ qw<Bcdf Bcdf> ],
[ qw<Alphabet Elphabat> ],
[ qw<Zoologicoarchaeologist Ziologecaarchoiologost> ],
);
use Test::More; plan tests => 0+@tests;
for (@tests) {
my ($in, $expected) = @{$_};
is task2($in), $expected, "$in -> $expected";
}
|