}
public static PairScore ordercountChoices(Stack<PairScoreWithDistance> stack)
{
ArrayList<PairScoreWithDistance> toptop = new ArrayList<PairScoreWithDistance>();
PairScoreWithDistance top = stack.peek();
int i=stack.size()-1;
while(i>=0)
{
PairScoreWithDistance curr = stack.get(i);--i;
if (curr.getScore() != top.getScore())
break;
toptop.add(curr);
}
PairScoreWithDistance high_pair = top;
for(PairScoreWithDistance t:toptop)
{
if(t!=top)
{
System.out.println("Distance Score of high= "+high_pair.getDistanceScore());
System.out.println("Distance Score of t= "+t.getDistanceScore());
if( t.getDistanceScore() > high_pair.getDistanceScore())
high_pair=t;
}
}
return high_pair;
}