I have 200+ countries with keywords.
Please find some sample keywords.
Expand Table
India | IN,Mumbai,Delhi,Mysore,Surat,Kolkata,Punjab,Bangalore |
---|---|
Iraq | IQ,BAGHDAD,BASRA,NAFJAF,KIRKUK,KARBALA,NASIRIYAS,AMARA |
China | CN,SHANGHAI,beijing,chongqing,guangzhou,tianjin,shenzhen,hangzhou,wuhan |
France | FRA,Paris,Lyon,Nice,Nantes,Reims,Lille |
England | UK,London,Manchester,Bristol,Liverpool,Southampton |
Russia | Moscow,Kazan,Omsk,Volgograd,Krasnoyarsk,Samara |
Afghanistan | AF,Kabul,kandahar,jalalabad,kandahar,herat,ghazni,khanabad |
Zimbabwe | Harare, Bulawayo, Manicaland, Midlands, Mashonaland West, Masvingo |
Germany | Berlin,Munich,Hamburg,stuttgart,essen,Leipzig |
Morocco | MA,Casablanca,Rabat,fez,Tangier,Agadir,kenitra,oujda,meknes |
Pakistan | Karachi,Lahore,Punjab,Islamabad,Hyderabad,Faisalabad,Peshawar,Multan,Bahawalpur,Sargodha |
Jamaica | JM,Kingston,Portmore,Montego,saint catherine,mandeville,maypen,holdharbour |
Mali | bamako,gao,sikasso,kalabancoro,koutiala,segou,kayes,kati,mopti,niono |
Iran | Hamadan, Ilam,Karaj, Tehran, East Azerbaijan, Semnan, Birjand, Bushehr |
Spain | Madrid,Barcelona,Seville,bilbao.valencia,cadiz,Girona |
I have given countries keywords with name in dictionary (key,value).
So i want to check address string from backside i e. Last word first to find accurate Country.
Basically I want to check string in reverse order if multiple country keywords found then it should return last keyword country name.
Input example 1:
“786 apartment, Shanghai building, Mumbai 400710”
It contains 2 keywords - 1 from (Shanghai)china and 1 from (Mumbai) India
Output:
India(Mumbai)
Input example 2:
" Abc Kingston apartment, near Uk ambassy , Madrid 7896 ES"
It contains 3 keywords- 1 from Jamaica (Kingston), 1 from England (UK) and 1 from Spain(Madrid)
Output:
Spain