Given an email address, the result of a transformation applied to that email address, and a second email address, return the output of the same transformation applied to the second email address.
The email addresses will all have the following structure:
A string of positive length containing alphanumeric characters and at most one .
(the local part), followed by an @
symbol, followed by a string of positive length containing alphanumeric sumbols (the domain), followed by a .
symbol, and a final string of positive length containing alphanumeric characters (the TLD).
There are four allowed transformations:
- Identity (no change). (
[email protected] -> [email protected]
) - Returning just the local part (everything before the
@
) unmodified ([email protected] -> a.b
). - Returning the local part split on the
.
if present, with the first symbol of each half capitalised. ([email protected] -> A B
). - Returning just the domain (everything between the
@
and the final.
) unmodified. ([email protected] -> c
).
When more than one transformation is possible, you can give the output of any of the possibilities. Whitespace at the start and end of output don't matter, but in the middle does (i.e. if you split a.b
to A B
there should be just one space in the middle [and any number at the start and end of output], but if you split a.
, then A
with any number of spaces on either side are all acceptable).
Examples (input | output
):
[email protected], John Doe, [email protected] | Phillip Maini
[email protected], John Doe, [email protected] | Phillip Maini
[email protected], foo.bar, [email protected] | gee.whizz
[email protected], foo.bar, [email protected] | gEe.Whizz
[email protected], comedy, [email protected] | office
[email protected], Jones, [email protected] | A
[email protected], [email protected], [email protected] | [email protected]
[email protected], .jones, [email protected] | a.
[email protected], x, [email protected] | 3
[email protected], [email protected], [email protected] | [email protected]
[email protected], John Jones, [email protected] | 1in Thehand
[email protected], Chicken Soup, [email protected] | Fab
[email protected], lange, [email protected] | fat.so
[email protected], Lange, [email protected] | {fat.so, Fat So} # either acceptable
[email protected], chicken, [email protected] | {horse, pig} # either acceptable
Usual rules and loopholes apply.
@
and final.
). Since the local part and domain are bothchicken
, it's ambiguous whether it's the 2nd or 4th transformation \$\endgroup\$A
[with a trailing space] that the second input beJones
[with a leading space])? \$\endgroup\$[email protected], Jones, [email protected]
isA
- ifjones
is matched that means the matching part is the part between the first period and the @ symbol. But that would result in an empty string because thea
is before the first period and not after. \$\endgroup\$