#include <stdio.h>

// Assuming the date, address, rankDetail, and officer structures are defined as before

struct date {
    int day;
    int month;
    int year;
};

struct address {
    char street[100];
    char city[50];
    char state[50];
    int zipCode;
    char planet[50];
};

struct rankDetail {
    char rank[30];
    struct date lastPromotionDate;
};

struct officer {
    char name[50];
    struct date dateOfBirth;
    struct address homeAddress;
    char ship[50];
};

// Function to read date from standard input
struct date readDate() {
    struct date d;
    scanf("%d/%d/%d", &d.month, &d.day, &d.year);
    return d;
}

// Function to read address from standard input
struct address readAddress() {
    struct address a;
    scanf(" %[^\n]s", a.street);  // Read until newline is encountered
    scanf(" %[^\n]s", a.city);
    scanf(" %[^\n]s", a.state);
    scanf("%d", &a.zipCode);
    scanf(" %[^\n]s", a.planet);
    return a;
}

int main() {
    struct officer o;
    printf("Enter officer's name: ");
    scanf(" %[^\n]s", o.name);  // Read string until newline is encountered

    printf("Enter officer's date of birth (MM/DD/YYYY): ");
    o.dateOfBirth = readDate();

    printf("Enter officer's address in the format: street, city, state, zip code, planet\n");
    o.homeAddress = readAddress();

    printf("Enter officer's ship: ");
    scanf(" %[^\n]s", o.ship);

    // Printing to verify the input
    printf("\nOfficer's Name: %s\n", o.name);
    printf("Date of Birth: %d/%d/%d\n", o.dateOfBirth.month, o.dateOfBirth.day, o.dateOfBirth.year);
    printf("Address: %s, %s, %s, %d, %s\n", o.homeAddress.street, o.homeAddress.city, o.homeAddress.state, o.homeAddress.zipCode, o.homeAddress.planet);
    printf("Ship: %s\n", o.ship);

    return 0;
}

