import java.util.ArrayList;
import java.util.List;

public class SyncStack {

	private List<Character> buffer = new ArrayList<>();
	
	// define method to retrieve character from the s
	public synchronized char pop() {
		char c;
		while(buffer.size() == 0) {
			try {
				// wait if stack is empty
				this.wait();
			}catch (InterruptedException e) {
				// ignore it...
			}
		}
	}
}
