UK and US Part 2

The following is the solution to the Hacker Rank problem “UK and US:
Part 2".
Algorithm > Regex > UK and US: Part 2