fork download
  1. <>;
  2.  
  3. while(<>){ # read next line to variable $_
  4. push @{
  5. $hash{
  6. lc (
  7. /\@bmail\.com$/i ?
  8. join '', map { split /\./ } /^.*?(?=[+\@])/g
  9. :
  10. $_
  11. )
  12. }
  13. }, $_
  14. }
  15.  
  16. print join "\n", scalar keys %hash, map @{ $_ } . " @{ $_ }", values %hash
Success #stdin #stdout 0s 6000KB
stdin
6
ICPC.@bmail.com
p+con+test@BMAIL.COM
P@bmail.com
a@bmail.com.ru
I.cpc@Bmail.Com
a+b@bmail.com.ru
stdout
4
2 p+con+test@BMAIL.COM P@bmail.com
2 ICPC.@bmail.com I.cpc@Bmail.Com
1 a+b@bmail.com.ru
1 a@bmail.com.ru