
public class NoOfa {

	public static int numberOfA(String s,char c){
		if(s.length()==1){
			if(s.equals(c))
				return 1;
			else
				return 0;
		}

		int index = s.indexOf(c);
		if(index==-1){
			return 0;
		}
		else
			return (1+numberOfA(s.substring(index+1),c));


	}

	
	public static String reverseWord(String s){
		
		if(s.length()==0 || s.length()==1){
			return s;
		}
		else{
			return s.charAt(s.length()-1)+reverseWord(s.substring(0, s.length()-1));
			//return reverseWord(s.substring(0, s.length()-1))+s.charAt(s.length()-1);
		}
		
	}
	
	public static void main(String[] args) {
		
		String s="aaxa";
		System.out.println(reverseWord("mohammad"));

	}

}
