import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
public class MapClass3
{
public static void main(String args[])throws IOException
{
try
{
Connection con;
Ex obj=new Ex();
List ll1=new ArrayList();
ll1=obj.getName();
// System.out.println(ll1);
con=S1.getConnection();
PreparedStatement pst=con.prepareStatement("select * from CITYNAME ");
ResultSet rs=pst.executeQuery();
HashMap hm = new HashMap();
String nc=null;
String sc=null;
while(rs.next())
{
nc=rs.getString("CITY");
sc=rs.getString("STDCITY");
hm.put(nc, sc);
//System.out.print(nc+" ");
//System.out.println(sc);
}
Set set = hm.keySet();
int length;
String temp1=null;
String temp=null;
int match=0;
int notMatch=0;
char[] chr;
char[] chr1;
for (Iterator iterator1 = ll1.iterator();iterator1.hasNext()

{
temp1 = (String) iterator1.next();
//System.out.println(temp1);
chr1=temp1.toCharArray();
System.out.println(chr1);
for (Iterator iterator = set.iterator(); iterator.hasNext()

{
temp = (String) iterator.next();
//System.out.println(temp);
chr = temp.toCharArray();
// System.out.println(chr);
if(temp1.length()<temp.length())
{
length=temp1.length();
}
else
{
length=temp.length();
}
for(int i=0;i<length;i++)
{
boolean equals = (chr[i]==chr1[i]);
if(equals!=true)
{
notMatch++;
}
else
{
match++;
}
}
if(notMatch<match)
{
System.out.println(hm.get(temp1));
}
}
/* if(temp.equals(temp1))
{
{
System.out.println("standard city name:"+hm.get(temp1));
}
}*/
}
}catch(Exception e)
{
ExceptionClass g=new ExceptionClass();
g.displayException(e);
}
}
}