<>;

while(<>){ # read next line to variable $_
	chomp;
	push @{
		$hash{ 
			lc ( 
				/\@bmail\.com$/i ? 
						join '', map { split /\./ } /^.*?(?=[+\@])/g 
					: 
						$_ 
				) 
			}
		}, $_
	}

print join "\n", scalar keys %hash, map @{ $_ } . " @{ $_ }", values %hash