Skip to content

Instantly share code, notes, and snippets.

@thameemk612 thameemk612/3
Created Oct 18, 2018

Embed
What would you like to do?
When E-mail addresses are spelled out, one pronounces a . as dot, an @ sign as at. As a result, we get something like blasphemy98atyahoodotcom . We need to obtain the real mail ID from this like - blasphemy98@yahoo.com .
It is known that a proper email address contains only such symbols as . @ and lower-case Latin letters, doesn't start with and doesn't end with a dot. Also, a proper email address doesn't start with and doesn't end with an at sign. Moreover, an email address contains exactly one such symbol as @, yet may contain any number (possible, zero) of dots.
A series of replacements has to be made so that the length of the result is as short as possible and it is a valid email address. If the lengths are equal, the lexicographically minimal result should be printed.
Example :
Input
codertowinatgmaildotcom
Ouput
codertowin@gmail.com
Input Format
dotdotdotatdotdotat
Constraints
Overall, two variants of replacement are possible: dot can be replaced by a dot, at can be replaced by an at.
Output Format
dot..@..at
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.