Where is NZEC exception in my code?

Hi there

I was participating in this contest http://www.codechef.com/DCL1501/problems/DCL2015B

and getting NZEC exception in my code.Here is my code


package DCL1501;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class TheNameList {
	
	private ArrayList<String> inputWordList;
	
	private TreeMap<String, Integer> result;
	
	public static void main(String[] args) {
		new TheNameList().solve();
	}

	public void solve(){
		
		try
		{
		inputWordList=new ArrayList<String>();
		
		result=new TreeMap<String, Integer>();
		
		Scanner in=new Scanner(System.in);
		
		int T=in.nextInt();
		
		for(int k=0;k<T;k++){
			
			inputWordList.add(in.next());
		}
		
		Collections.sort(inputWordList);
		
		int count=1;
		for(int i=1;i<inputWordList.size();i++){
			
			String word=inputWordList.get(i);
			
			if(word.equals(inputWordList.get(i-1))){
				count++;
			}
			else
			{
				
				result.put(inputWordList.get(i-1), count);
				count=1;
			}
			if(!(word.equals(inputWordList.get(i-1)))&&(i==(inputWordList.size()-1)))
			{
		        result.put(word, 1);
			}
		}
		
		
		for(Map.Entry<String,Integer> entry : result.entrySet()) {
			  String key = entry.getKey();
			  Integer value = entry.getValue();

			  System.out.println(key+" "+value);
			}
		
		}
		catch(Exception e){
			System.out.println("Exception occured");
		}
		
	}
}

I want to know where is NZEC?