And just for variety (and also because this really *IS* the one way I can make OP's description make sense), do you mean you want to "show" the second char of each contiguously paired char?
That would be, in the example provided by salva, 'abccabbcabc', and used by several other respondents:
c b
which this provides:
#!/usr/bin/perl
use warnings;
use strict;
# 856624
my $str = 'abccabbcabc';
my @chars = split(//, $str);
my $seen = '-';
for my $char(@chars) {
if ($char =~ $seen ) {
print $char . "\t|\t"; # skip the tabs and pipe if desired
} else {
$seen = $char;
}
}
=head Output:
c | b |
=cut
|