// Arup Guha
// 7/7/2011
// Example illustrating String methods: Finds the first name alphabetically in a list.

import java.util.*;

public class FirstName {
	
	
	public static void main(String[] args) {
		
		Scanner stdin = new Scanner(System.in);
		
		System.out.println("Please enter 10 last names, without spaces.");
		
		// Read in the first name.
		String first = stdin.next();
		
		for (int i=1; i<10; i++) {
			
			String next = stdin.next();
			
			// If this string comes before the first we've seen, replace first.
			if (next.compareToIgnoreCase(first) < 0)
				first = next;
		}
		
		// Output the result.
		System.out.println("The first name alphabetically was "+first);
	}
}