use strict; use warnings; my $s = <>; chomp $s; my @count; for(my $i = 0; $i < 3; $i++) { $count[$i] = 0; } $count[0] = (() = $s =~ /t/g); $count[1] = (() = $s =~ /r/g); $count[2] = (() = $s =~ /e/g); $count[2] /= 2; $count[2] = int $count[2]; @count = sort {$a <=> $b} @count; print "$count[0]\n"; exit;