public String countAndSay(int n) {
        if(n == 1)
        	return "1";
        String pre = countAndSay(n - 1);
        
        int count = 1;
        char c = pre.charAt(0);
        String result = "";
        if(pre.length() == 1){
        	result = "1"+c;
        	return result;
        }
        	
        for(int i = 1; i < pre.length(); i++){
        		if(pre.charAt(i) != c){
        			result += ( String.valueOf(count) + c );
        			c = pre.charAt(i);
        			count = 1;
        		}
        		else{
        			count ++;
        			
        		}
        	
        }
        result += (String.valueOf(count) + c);
        return result;
    }