Advertisement
Guest User

Untitled

a guest
May 25th, 2018
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. Goal
  2. – Oh no! The killer must have followed her on vacation! But to find them we'd have to search through 200MB of emails looking for something formatted like an address!
  3. – It's hopeless!
  4.  
  5. – Everybody stand back.
  6.  
  7. You are given a raw email archive. You must count the number of likely email addresses in there.
  8.  
  9. As opposed to real life, a likely email address in this problem:
  10. • is wrapped in angle brackets <>
  11. • contains a unique at sign @
  12. • left of the at sign, contains any non-empty combination of ASCII letters, digits, and symbols ! " # $ % & ' ( ) * + , - . / : ; = ? [ \ ] ^ _ ` { | } ~
  13. • right of the at sign, contains any non-zero number of words separated by a dot .
  14.  – those words must start with a letter, and may contain ASCII letters, digits, and a hyphen -
  15.  – the last word must be letters only
  16.  – if there's only one word, it must be succeded by a dot .
  17. Input
  18. A raw archive.
  19. It's so raw you do not know in advance how long it is. Read all you can until end of stream.
  20.  
  21. (except for the site limit of 10k)
  22. Output
  23. An integer N, number of likely email addresses in the archive.
  24. Constraints
  25. The domain name need not be actually registered.
  26. Example
  27. Input
  28. Valid:
  29. - <steve@example.com>
  30. - <john.doe@codingame.com>
  31. - <un{ba[lan)cea'ble@xxx.>
  32. Invalid:
  33. - [(balanced)@example.com]
  34. - <inigo montoya@buttercup.net>
  35. - <bill@example>
  36. - <timey!uucp!gw!ucb>
  37. Output
  38. 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement