#!/usr/bin/python
import sys
import re

countryList = ['Afghanistan',
'Albania',
'Algeria',
'American Samoa',
'Andorra',
'Angola',
'Anguilla',
'Antigua and Barbuda',
'Argentina',
'Armenia',
'Aruba',
'Australia',
'Austria',
'Azerbaijan',
'Bahamas',
'Bahrain',
'Bangladesh',
'Barbados',
'Belarus',
'Belgium',
'Belize',
'Benin',
'Bermuda',
'Bhutan',
'Bolivia',
'Bonaire',
'Bosnia-Herzegovina',
'Botswana',
'Bouvet Island',
'Brazil',
'Brunei',
'Bulgaria',
'Burkina Faso',
'Burundi',
'Cambodia',
'Cameroon',
'Canada',
'Cape Verde',
'Cayman Islands',
'Central African Republic',
'Chad',
'Chile',
'China',
'Christmas Island',
'Cocos (Keeling) Islands',
'Colombia',
'Comoros',
'Congo, Democratic Republic of the (Zaire)',
'Congo, Republic of',
'Cook Islands',
'Costa Rica',
'Croatia',
'Cuba',
'Curacao',
'Cyprus',
'Czech Republic',
'Denmark',
'Djibouti',
'Dominica',
'Dominican Republic',
'Ecuador',
'Egypt',
'El Salvador',
'Equatorial Guinea',
'Eritrea',
'Estonia',
'Ethiopia',
'Falkland Islands',
'Faroe Islands',
'Fiji',
'Finland',
'France',
'French Guiana',
'Gabon',
'Gambia',
'Georgia',
'Germany',
'Ghana',
'Gibraltar',
'Greece',
'Greenland',
'Grenada',
'Guadeloupe (French)',
'Guam',
'Guatemala',
'Guinea',
'Guinea Bissau',
'Guyana',
'Haiti',
'Holy See',
'Honduras',
'Hong Kong',
'Hungary',
'Iceland',
'India',
'Indonesia',
'Iran',
'Iraq',
'Ireland',
'Israel',
'Italy',
'Ivory Coast', 'Cote D`Ivoire',
'Jamaica',
'Japan',
'Jordan',
'Kazakhstan',
'Kenya',
'Kiribati',
'Kosovo',
'Kuwait',
'Kyrgyzstan',
'Laos',
'Latvia',
'Lebanon',
'Lesotho',
'Liberia',
'Libya',
'Liechtenstein',
'Lithuania',
'Luxembourg',
'Macau',
'Macedonia',
'Madagascar',
'Malawi',
'Malaysia',
'Maldives',
'Mali',
'Malta',
'Marshall Islands',
'Martinique',
'Mauritania',
'Mauritius',
'Mayotte',
'Mexico',
'Micronesia',
'Moldova',
'Monaco',
'Mongolia',
'Montenegro',
'Montserrat',
'Morocco',
'Mozambique',
'Myanmar',
'Namibia',
'Nauru',
'Nepal',
'Netherlands',
'Netherlands Antilles',
'New Caledonia',
'New Zealand',
'Nicaragua',
'Niger',
'Nigeria',
'Niue',
'Norfolk Island',
'North Korea',
'Northern Mariana Islands',
'Norway',
'Oman',
'Pakistan',
'Palau',
'Panama',
'Papua New Guinea',
'Paraguay',
'Peru',
'Philippines',
'Pitcairn Island',
'Poland',
'Polynesia', 'French Polynesia',
'Portugal',
'Puerto Rico',
'Qatar',
'Reunion',
'Romania',
'Russia',
'Rwanda',
'Saint Helena',
'Saint Kitts and Nevis',
'Saint Lucia',
'Saint Pierre and Miquelon',
'Saint Vincent and Grenadines',
'Samoa',
'San Marino',
'Sao Tome and Principe',
'Saudi Arabia',
'Senegal',
'Serbia',
'Seychelles',
'Sierra Leone',
'Singapore',
'Sint Maarten',
'Slovakia',
'Slovenia',
'Solomon Islands',
'Somalia',
'South Africa',
'South Georgia and South Sandwich Islands',
'South Korea',
'South Sudan',
'South Sudan',
'Spain',
'Sri Lanka',
'Sudan',
'Suriname',
'Svalbard and Jan Mayen Islands',
'Swaziland',
'Sweden',
'Switzerland',
'Syria',
'Taiwan',
'Tajikistan',
'Tanzania',
'Thailand',
'Timor-Leste', 'East Timor)',
'Togo',
'Tokelau',
'Tonga',
'Trinidad and Tobago',
'Tunisia',
'Turkey',
'Turkmenistan',
'Turks and Caicos Islands',
'Tuvalu',
'Uganda',
'Ukraine',
'United Arab Emirates',
'United Kingdom',
'United States', 'United States of America', 'US', 'USA',
'Uruguay',
'Uzbekistan',
'Vanuatu',
'Venezuela',
'Vietnam',
'Virgin Islands',
'Wallis and Futuna Islands',
'Yemen',
'Zambia',
'Zimbabwe',
'xk']

stateDict = {'Alabama': 'AL', 'AL' : 'AL',
'Arizona': 'AZ', 'AZ': 'AZ',
'Arkansas': 'AR', 'AR': 'AR',
'California': 'CA', 'CA': 'CA',
'Colorado': 'CO', 'CO': 'CO',
'Connecticut': 'CT', 'CT': 'CT',
'Delaware': 'DE', 'DE': 'DE',
'Florida': 'FL', 'FL': 'FL',
'Georgia': 'GA', 'GA': 'GA',
'Hawaii': 'HI', 'HI': 'HI',
'Idaho': 'ID', 'ID': 'ID',
'Illinois': 'IL', 'IL': 'IL',
'Indiana': 'IN', 'IN': 'IN',
'Iowa': 'IA', 'IA': 'IA',
'Kansas': 'KS', 'KS': 'KS',
'Kentucky': 'KY', 'KY': 'KY',
'Louisiana': 'LA', 'LA': 'LA',
'Maine': 'ME', 'ME': 'ME',
'Maryland': 'MD', 'MD': 'MD',
'Massachusetts': 'MA', 'MA': 'MA',
'Michigan': 'MI', 'MI': 'MI',
'Minnesota': 'MN', 'MN': 'MN',
'Mississippi': 'MS', 'MS': 'MS',
'Missouri': 'MO', 'MO': 'MO',
'Montana': 'MT', 'MT': 'MT',
'Nebraska': 'NE', 'NE': 'NE',
'Nevada': 'NV', 'NV': 'NV',
'New Hampshire': 'NH', 'NH': 'NH',
'New Jersey': 'NJ', 'NJ': 'NJ',
'New Mexico': 'NM', 'NM': 'NM',
'New York': 'NY', 'NY': 'NY',
'North Carolina': 'NC', 'NC': 'NC',
'North Dakota': 'ND', 'ND': 'ND',
'Ohio': 'OH', 'OH': 'OH',
'Oklahoma': 'OK', 'OK': 'OK',
'Oregon': 'OR', 'OR': 'OR',
'Pennsylvania': 'PA', 'PA': 'PA',
'Rhode Island': 'RI', 'RI': 'RI',
'South Carolina': 'SC', 'SC': 'SC',
'South Dakota': 'SD', 'SD': 'SD',
'Tennessee': 'TN', 'TN': 'TN',
'Texas': 'TX', 'TX': 'TX',
'Utah': 'UT', 'UT': 'UT',
'Vermont': 'VT', 'VT': 'VT',
'Virginia': 'VA', 'VA': 'VA',
'Washington': 'WA', 'WA': 'WA',
'West Virginia': 'WV', 'WV': 'WV',
'Wisconsin': 'WI', 'WI': 'WI',
'Wyoming': 'WY', 'WY': 'WY'}

alphaSpace = ['a ', 'b ', 'c ', 'd ', 'e ', 'f ', 'g ','h ', 'i ', 'j ', 'k ', 'l ', 'm ',\
'n ', 'o ', 'p ', 'q ', 'r ', 's ', 't ', 'u ', 'v ', 'w ', 'x ', 'y ', 'z ']