Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s = """USA touches: Canada, Mexico
- Canada touches: USA
- Mexico touches: USA, Belize, Guatemala
- Guatemala touches: Mexico, Belize, El Salvador, Honduras
- Belize touches: Mexico, Guatemala
- El Salvador touches: Guatemala, Honduras
- Honduras touches: Guatemala, El Salvador, Nicaragua
- Nicaragua touches: Honduras, San Jose
- San Jose touches: Nicaragua, Panama
- Panama touches: San Jose, Columbia
- Columbia touches: Venezuela, Brazil, Peru, Ecuador
- Venezuela touches: Columbia, Brazil, Guyana
- Guyana touches: Venezuela, Brazil, Suriname
- Suriname touches: Guyana, Brazil, French Guiana
- French Guiana touches: Suriname, Brazil
- Brazil touches: Columbia, Venezuela, Guyana, Suriname, French Guiana, Peru, Bolivia, Paraguay, Argentina, Uruguay
- Ecuador touches: Columbia, Peru
- Peru touches: Ecuador, Columbia, Brazil, Bolivia, Chile
- Bolivia touches: Peru, Brazil, Paraguay, Argentina, Chile
- Chile touches: Peru, Bolivia, Argentina
- Paraguay touches: Bolivia, Brazil, Argentina
- Argentina touches: Chile, Bolivia, Paraguay, Brazil, Uruguay
- Uruguay touches: Argentina, Brazil
- The Bahamas touches:
- Cuba touches:
- Jamaica touches:
- Haiti touches: Dominican Republic
- Dominican Republic touches: Haiti
- Puerto Rico touches:
- Saint Kitts and Nevis touches:
- Montserrat touches:
- Guadeloupe touches:
- Dominica touches:
- Martinique touches:
- Saint Vincent touches:
- Barbados touches:
- Trinidad and Tobago touches:
- Greenland touches:
- Azores touches:
- Falkland Islands touches:
- South Georgia touches:
- Cape Verde touches:
- Madeira Island touches:
- Canary Islands touches:
- Faroe Islands touches:
- Republic of Ireland touches: United Kingdom
- United Kingdom touches: Republic of Ireland
- Svalbard touches:
- Norway touches: Sweden, Finland, Russia
- Sweden touches: Norway, Finland
- Finland touches: Sweden, Norway, Russia
- Russia touches: Norway, Finland, Estonia, Latvia, Belarus, Ukraine, Turkey, Armenia, Azerbaijan, Kazakhstan, China, Mongolia, North Korea
- Denmark touches: Germany
- Estonia touches: Russia, Latvia
- Latvia touches: Estonia, Russia, Belarus, Lithuania
- Lithuania touches: Latvia, Belarus, Poland
- Belarus touches: Lithuania, Latvia, Russia, Ukraine, Poland
- Germany touches: Luxembourg, Belgium, Netherlands, Denmark, Poland, Czech Republic, Austria, Liechtenstein, Switzerland, France
- Netherlands touches: Germany, Belgium
- Belgium touches: France, Netherlands, Germany, Luxembourg
- Luxembourg touches: France, Belgium, Germany
- Poland touches: Germany, Lithuania, Belarus, Ukraine, Slovakia, Czech Republic
- Ukraine touches: Slovakia, Poland, Belarus, Russia, Romania, Moldova, Hungary
- Czech Republic touches: Germany, Poland, Slovakia, Austria
- Slovakia touches: Austria, Czech Republic, Poland, Ukraine, Hungary
- Moldova touches: Ukraine, Romania
- Romania touches: Hungary, Ukraine, Moldova, Bulgaria, Serbia
- Hungary touches: Austria, Slovakia, Ukraine, Romania, Serbia, Croatia, Slovenia
- Austria touches: Liechtenstein, Germany, Czech Republic, Slovakia, Hungary, Slovenia, Italy, Switzerland
- Liechtenstein touches: Switzerland, Germany, Austria
- France touches: Belgium, Luxembourg, Germany, Switzerland, Italy, Spain
- Switzerland touches: France, Germany, Liechtenstein, Austria, Italy
- Slovenia touches: Italy, Austria, Hungary, Croatia
- Croatia touches: Slovenia, Hungary, Serbia, Bosnia and Herzegovina
- Bosnia and Herzegovina touches: Croatia, Serbia, Montenegro
- Serbia touches: Bosnia and Herzegovina, Croatia, Hungary, Romania, Bulgaria, Macedonia, Albania, Montenegro
- Bulgaria touches: Serbia, Romania, Turkey, Greece, Macedonia
- Montenegro touches: Bosnia and Herzegovina, Serbia, Albania
- Albania touches: Montenegro, Serbia, Macedonia, Greece
- Macedonia touches: Albania, Serbia, Bulgaria, Greece
- Italy touches: France, Switzerland, Austria, Slovenia
- Spain touches: Portugal, France
- Portugal touches: Spain
- Greece touches: Albania, Macedonia, Bulgaria, Turkey
- Turkey touches: Greece, Russia, Armenia, Azerbaijan, Iran, Iraq, Syria
- Malta touches:
- Cyprus touches:
- Armenia touches: Turkey, Russia, Azerbaijan, Iran
- Azerbaijan touches: Turkey, Armenia, Russia, Iran
- Kazakhstan touches: Russia, China, Uzbekistan, Turkmenistan
- Mongolia touches: China, Russia
- North Korea touches: China, Russia, South Korea
- South Korea touches: North Korea
- China touches: Afghanistan, Uzbekistan, Kazakhstan, Russia, Mongolia, North Korea, Vietnam, Laos, Myanmar, India, Bhutan, Nepal, Kashmir
- Uzbekistan touches: Kazakhstan, China, Afghanistan, Turkmenistan
- Afghanistan touches: Iran, Turkmenistan, Uzbekistan, China, Kashmir, Pakistan
- Turkmenistan touches: Kazakhstan, Uzbekistan, Afghanistan, Iran
- Iran touches: Iraq, Turkey, Azerbaijan, Armenia, Turkmenistan, Afghanistan, Pakistan
- Iraq touches: Jordan, Syria, Turkey, Iran, Kuwait, Saudi Arabia
- Syria touches: Lebanon, Turkey, Iraq, Jordan, Israel
- Lebanon touches: Israel, Syria
- Israel touches: Egypt, Lebanon, Syria, Jordan
- Jordan touches: Israel, Syria, Iraq, Saudi Arabia
- Saudi Arabia touches: Jordan, Iraq, Kuwait, Qatar, United Arab Emirates, Oman, Yemen
- Kuwait touches: Iraq, Saudi Arabia
- Qatar touches: Saudi Arabia
- United Arab Emirates touches: Saudi Arabia, Oman
- Oman touches: Saudi Arabia, United Arab Emirates, Yemen
- Yemen touches: Saudi Arabia, Oman
- Pakistan touches: Iran, Afghanistan, Kashmir, India
- Kashmir touches: Pakistan, Afghanistan, China, India
- India touches: Pakistan, Kashmir, Nepal, Bhutan, Myanmar, Bangladesh
- Nepal touches: India, China
- Bhutan touches: India, China
- Bangladesh touches: India, Myanmar
- Sri Lanka touches:
- Adaman and Nicobar Islands touches:
- Myanmar touches: Bangladesh, India, China, Laos, Thailand
- Thailand touches: Myanmar, Laos, Cambodia, Malaysia
- Laos touches: Myanmar, China, Vietnam, Cambodia, Thailand
- Vietnam touches: Laos, China, Cambodia
- Cambodia touches: Thailand, Laos, Vietnam
- Malaysia touches: Thailand, Brunei, Indonesia
- Brunei touches: Malaysia
- Phillipines touches:
- Indonesia touches: Malaysia, Papua New Guinea, Australia
- Papua New Guinea touches: Indonesia
- Australia touches:
- Tasmania touches:
- Japan touches:
- Guam touches:
- Solomon Islands touches:
- Vanuatu touches:
- Fiji touches:
- New Caledonia touches:
- New Zealand touches:
- Kerguelen Island touches:
- Heard Island touches:
- Mauritius touches:
- Reunion touches:
- Mayotte touches:
- Comoros touches:
- Madagascar touches:
- Sao Tome touches:
- Bioko touches:
- Egypt touches: Libya, Israel, Sudan
- Libya touches: Algeria, Tunisia, Egypt, Sudan, Chad, Niger
- Tunisia touches: Algeria, Libya
- Algeria touches: Western Sahara, Morocco, Tunisia, Libya, Niger, Mali, Mauritania
- Morocco touches: Western Sahara, Algeria
- Western Sahara touches: Morocco, Algeria, Mauritania
- Mauritania touches: Western Sahara, Algeria, Mali, Senegal
- Senegal touches: The Gambia, Mauritania, Mali, Guinea, Guinea-Bissau
- The Gambia touches: Senegal
- Guinea-Bissau touches: Senegal, Guinea
- Guinea touches: Guinea-Bissau, Senegal, Mali, Cote D'Ivoire, Liberia, Sierra Leone
- Sierra Leone touches: Guinea, Liberia
- Liberia touches: Sierra Leone, Guinea, Cote D'Ivoire
- Cote D'Ivoire touches: Liberia, Guinea, Mali, Burkina Faso, Ghana
- Mali touches: Senegal, Mauritania, Algeria, Niger, Burkina Faso, Cote D'Ivoire, Guinea
- Burkina Faso touches: Mali, Niger, Benin, Togo, Ghana, Cote D'Ivoire
- Ghana touches: Cote D'Ivoire, Burkina Faso, Togo
- Togo touches: Ghana, Burkina Faso
- Benin touches: Togo, Burkina Faso, Niger, Nigeria
- Niger touches: Burkina Faso, Mali, Algeria, Libya, Chad, Nigeria, Benin
- Nigeria touches: Benin, Niger, Chad, Cameroon
- Chad touches: Niger, Libya, Sudan, Central African Republic, Cameroon, Nigeria
- Sudan touches: Chad, Libya, Egypt, Eritrea, Ethiopia, Kenya, Uganda, Democratic Republic of the Congo, Central African Republic
- Eritrea touches: Sudan, Djibouti, Ethiopia
- Djibouti touches: Ethiopia, Eritrea, Somalia
- Ethiopia touches: Sudan, Eritrea, Djibouti, Somalia, Kenya
- Somalia touches: Kenya, Ethiopia, Djibouti
- Kenya touches: Uganda, Sudan, Ethiopia, Somalia, Tanzania
- Uganda touches: Democratic Republic of the Congo, Sudan, Kenya, Tanzania, Rwanda
- Democratic Republic of the Congo touches: Cabinda, Congo, Central African Republic, Sudan, Uganda, Rwanda, Burundi, Zambia, Angola
- Central African Republic touches: Cameroon, Chad, Sudan, Democratic Republic of the Congo, Congo
- Cameroon touches: Nigeria, Chad, Central African Republic, Congo, Gabon, Equatorial Guinea
- Equatorial Guinea touches: Cameroon, Gabon
- Gabon touches: Equatorial Guinea, Cameroon, Congo
- Congo touches: Gabon, Cameroon, Central African Republic, Democratic Republic of the Congo, Cabinda
- Rwanda touches: Democratic Republic of the Congo, Uganda, Tanzania, Burundi
- Burundi touches: Democratic Republic of the Congo, Rwanda, Tanzania
- Tanzania touches: Burundi, Rwanda, Uganda, Kenya, Mozambique, Malawi, Zambia
- Cabinda touches: Congo, Democratic Republic of the Congo
- Angola touches: Democratic Republic of the Congo, Zambia, Namibia
- Zambia touches: Angola, Democratic Republic of the Congo, Tanzania, Malawi, Mozambique, Zimbabwe, Botswana, Namibia
- Malawi touches: Zambia, Tanzania, Mozambique
- Mozambique touches: Zimbabwe, Zambia, Malawi, Tanzania, South Africa, Swaziland
- Zimbabwe touches: Namibia, Zambia, Mozambique, South Africa, Botswana
- Botswana touches: Namibia, Zambia, Zimbabwe, South Africa
- Namibia touches: Angola, Zambia, Zimbabwe, Botswana, South Africa
- South Africa touches: Namibia, Botswana, Zimbabwe, Mozambique, Swaziland, Lesotho
- Swaziland touches: South Africa, Mozambique
- Lesotho touches: South Africa"""
- names = []
- for row in s.split("\n\n"):
- names.append(row.split(" touches:")[0])
- print "\n".join(names)
- countries = []
- for row in s.split("\n\n"):
- name = row.split(" touches:")[0]
- touching = row.split(" touches:")[1][1:].split(", ")
- lst = [name]
- for t in touching:
- if t in names:
- lst.append(names.index(t))
- countries.append(lst)
- o = "["
- for country in countries:
- o += "[\"" + country[0] + "\"," + ",".join(map(str, country[1: ])) + "],"
- print o[:-1] + "]"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement