Find Mirror image of the string


Problem:
Find Mirror image of the string: like for name “arora”, “o” is the mirror image of arora.

Solution:

	//15. Find Mirror point of the String
	class mirrorImage {
	    public int solution(String S) {
	        int strLength = S.length();
	        if(strLength%2==0){
	         return -1;   
	        }
	        
	        int midPoint =  (strLength/2);
	        for(int i=0; i<midPoint; i++){
	            if(S.charAt((midPoint-1)-i)!=S.charAt(midPoint+1+i)){
	                return -1;
	            }
	        }
	        
	        return midPoint;
	    }
	}