// Arup Guha
// 9/2/2026
// Code to test out some String Class Methods.

import java.util.*;

public class teststring {

	public static void main(String[] args) {
	
		// Get a word.
		Scanner stdin = new Scanner(System.in);
		System.out.println("Enter a word.");
		String word = stdin.next();
		
		// One way to count a letter.
		int countE = 0;
		for (int i=0; i<word.length(); i++) {
			if (word.charAt(i) == 'E' || word.charAt(i) == 'e')
				countE++;
		}
		System.out.println("The number of e's in "+word+" is "+countE);
		
		// Another way to do the same.
		int countE2 = 0;
		String tmp = word.toLowerCase();
		for (int i=0; i<tmp.length(); i++)
			if (tmp.charAt(i) == 'e')
				countE2++;
		System.out.println("Alt cnt: The number of e's in "+tmp+" is "+countE2);
		
		// Get two strings.
		System.out.println("Enter two strings");
		String s1 = stdin.next();
		String s2 = stdin.next();
		
		// Play around with this so you really understand how this works.
		if (s1.compareTo(s2) < 0)
			System.out.println(s1+" comes before "+s2);
		else if (s1.compareTo(s2) > 0)
			System.out.println(s1 + " comes after "+s2);
		else
			System.out.println(s1+" and "+s2+" are the same.");
	}
}