#include <stdio.h>

void main(int argc,char *argv[]) {
  char input[256];
  char from_address[256]="";
  int x,y,z;

  /* Scan headers */
  while(fgets(input,255,stdin)>0&&((input[0]!='F'&&input[0]!='f')||input[1]!='r'||input[2]!='o')) {}
      x=0;y=0;
      while(input[x]!=':'){x=x+1;}
      x=x+1;
      while(input[x]<=32){x=x+1;}
      z=x;
      while(input[x]>32){
        from_address[y]=input[x];
        x=x+1;y=y+1;
      }
      from_address[y]=0;
      x=0; /* look for <address> */
      while(input[x]>31&&input[x]!='<'){x=x+1;}
      if(input[x]=='<'){
        y=0;x=x+1;
        while(input[x]>32&&input[x]!='>'){
          from_address[y]=input[x];
          x=x+1;y=y+1;
        }
        from_address[y]=0;
      }
      /*strip off site name if they included the entire address*/ 
      x=0;
      while(from_address[x]>32){
        if (from_address[x]=='@') {from_address[x]=0;}
        else x++;
      }
      /* Remove mg5n+alias! */
/* we don't need this for alpha.c2.org...
      x=0;
      while(from_address[x]>32){
        if (from_address[x]=='!') {
          y=0;x++;
          while(from_address[x]>32){
            from_address[y]=from_address[x];
            x++;y++;
	  }
          from_address[y]=0;
	}
        else x++;
      }*/
      /* de-capitalize and remove funky characters */
  /* (don't allow any create-a-file-anywhere hacks! :) */
      x=0;
      while(from_address[x]!=0){
        if (from_address[x]>='A'&&from_address[x]<='Z') {
          from_address[x]+=32;
	}
        if ((from_address[x]<'a'||from_address[x]>'z')&&
            (from_address[x]<'0'||from_address[x]>'9')&&from_address[x]!='-') {
          from_address[x]='_';
        }
        x++;
      }
  printf("%s",from_address);
}
