package com.xz;

public class Test {
	
	public static void main(String[] args) {
		
		
		System.out.println("max length");
		
	}
	
	public void getRight(){
		
		String name="problem a";
		System.out.println(name.lastIndexOf("d"));
		
	}

	public void getLeft() {

		String name = "i have a problem b";
		System.out.println(name.lastIndexOf("o"));

	}

}

package com.xz;

public class Test {
	
	public static void main(String[] args) {
		
		
		System.out.println("max length");
		
	}
	
	public void getRight(){
		
		String name="problem a";
		System.out.println(name.lastIndexOf("d"));
		
	}

	public void getLeft() {

		String name = "i have a problem b";
		System.out.println(name.lastIndexOf("a"));

	}
	
	public String getName() {

		String name = "";
		return name;
	}

}

Update Test.java