summaryrefslogblamecommitdiffstats
path: root/SUBS.pl
blob: 1084877f716211c9fad9ec1478de8ffd7d83342d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                          
#!/usr/bin/env perl
use strict;
use warnings;
use 5.016;

chomp(my $string = <>);
chomp(my $substr = <>);
my @positions;

my $start = 0;
while((my $pos = index($string, $substr, $start)) != -1) {
    push @positions, $pos + 1;
    $start = $pos + 1;
}

say join(' ', @positions);