void main() {
    String address = "Room 101, floor 3";
    int letters = 0;
    int digits = 0;
    int others = 0;

    for (int i = 0; i < address.length(); i++) {
        char c = address.charAt(i);
        if (Character.isLetter(c)) {
            letters++;
        } else if (Character.isDigit(c)) {
            digits++;
        } else {
            others++;
        }
    }

    IO.println(letters + " letters, " + digits + " digits, " + others + " others");
}

// From Groundwork, chapter 8 (ch08-strings-as-data), box 15.
// This example is from Groundwork, licensed CC BY-NC-SA 4.0.
// Run with: java ch08_15.java
