//SOLUTION
import java.util.ArrayList;
public class Bookshelf 
{
    ArrayList<Book> books;

    /**
     * Creates an empty Bookshelf containing no books
     */
    public Bookshelf()
    {
        books = new ArrayList<>();
    }

    /**
     * Adds a Book to the Bookshelf
     * @param b the book to add
     */
    public void add(Book b) 
    {
        books.add(b);
    }

    /**
     * Gets the name of the longest Book in the Bookshelf 
     * @return the name of the longest Book in the Bookshelf or empty 
     * string if the Bookshelf is empty
     */
    public String longest() 
    {
        if (books.size() == 0)
        {
            return "";
        }

        Book longest = books.get(0);
        for (Book b: books)
        {
            if (b.getPages() > longest.getPages())
            {
                longest = b;
            }
        }

        return longest.getName();		
    }
    
    public int bookCount()
    {
        return books.size();
    }
}
