using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
public class Test
{
public static void Main()
{
var salutaionsString = "Mr,Ms,Mrs,Miss,Mister,Master,Dr,Doctor";
var salutations = new HashSet<string>(salutaionsString.Split(','));
for (var name = Console.ReadLine(); name != null; name = Console.ReadLine())
{
var nameParts = name.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
var lastName = nameParts[nameParts.Length - 1];
bool skipFirst = false;
if (nameParts.Length > 1 && salutations.Contains(nameParts[0]))
{
skipFirst = true;
}
StringBuilder sb = new StringBuilder();
for (var i = skipFirst ? 1 : 0; i < nameParts.Length - 1; i++)
{
sb.Append(Char.ToUpper(nameParts[i][0]) + ". ");
}
sb.Append(Char.ToUpper(lastName[0]));
sb.Append(lastName.ToCharArray().Skip(1).ToArray());
Console.WriteLine(sb.ToString());
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLlRleHQ7CnVzaW5nIFN5c3RlbS5MaW5xOwoKcHVibGljIGNsYXNzIFRlc3QKewoJcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKQoJewoJCXZhciBzYWx1dGFpb25zU3RyaW5nID0gIk1yLE1zLE1ycyxNaXNzLE1pc3RlcixNYXN0ZXIsRHIsRG9jdG9yIjsKCgkJdmFyIHNhbHV0YXRpb25zID0gbmV3IEhhc2hTZXQ8c3RyaW5nPihzYWx1dGFpb25zU3RyaW5nLlNwbGl0KCcsJykpOwoJCQoJCWZvciAodmFyIG5hbWUgPSBDb25zb2xlLlJlYWRMaW5lKCk7IG5hbWUgIT0gbnVsbDsgbmFtZSA9IENvbnNvbGUuUmVhZExpbmUoKSkKCQl7CgkJCXZhciBuYW1lUGFydHMgPSBuYW1lLlNwbGl0KG5ldyBjaGFyW10geyAnICcgfSwgU3RyaW5nU3BsaXRPcHRpb25zLlJlbW92ZUVtcHR5RW50cmllcyk7CgkJCXZhciBsYXN0T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