@model IEnumerable<MvcBootstrap.Models.CambridgeModel>
@{
ViewBag.Title = "CambridgeTest";
Layout = "~/Views/Shared/_Layout.cshtml";
}
@*<div class="row col-sm-12 text-center"><h4 style="color:red;">(click on headings for code snippets)</h4></div>*@
<div class="row col-sm-12">
<div class="col-sm-4"></div>
<div class="col-sm-4 text-center">
<h1>Cambridge Test</h1>
</div>
<div class="col-sm-4"></div>
</div>
<div class="row cold-sm-12 text-center" style="border:2px solid blue;">
<label>Unique Emails:</label>
<label id="lblEmailCount" class="control-label">@ViewBag.lblEmailCount</label>
</div>
<div class="row col-sm-12" style="font-weight:bold; font-size:large;">
@if (Model != null && Model.Count() > 0)
{
foreach (var item in Model)
{
<div class="row col-sm-12">
<div class="col-sm-6">
@String.Format("{0}", item.OriginalEmail)
</div>
<div class="col-sm-6">
@String.Format("{0}", item.EditedEmail)
</div>
</div>
}
}
</div>
<div class="row col-sm-12" style="height:10px;"></div>
<div class="row col-sm-12">
<pre>
An email address consists of a local name and a domain name, separated by the `@` symbol.
For example, in `user@example.com`, `user` is the local name, and `example.com` is the domain name.
Besides lowercase letters, these emails may also contain `.` or `+` symbols.
If the sender adds a `.` symbol in the local name, mail sent there will be forwarded to the same address without `.` in the local name.
For example, `user.abc@example.com` and `userabc@example.com` forward to the same email address. Note, this rule does not apply to domain names.
If the sender adds a `+` symbol in the local name, everything after the first plus sign will be ignored. This allows certain emails to be filtered.
For example, `user+123@example.com` will be forwarded to `user@example.com`. Again note, this rule does not apply to domain names.
It is possible to use both of these rules at the same time.
Given a string[] of email addresses, how many unique emails will there be after these filters are applied?
Sample Input:
string[] emails = {
"test.email+amir@example.com", testemail@example.com
"test.e.mail+amir.betty@example.com", testemail@example.com
"testemail+lisa@exam.ple.com", testemail@exam.ple.com
"test.e.m.a.i.l@example.com", testemail@example.com
"testemaile@xample.com" testemaile@xample.com
};
Output:
3
</pre>
</div>
<div>
</div>