// Escribe en mayúsculas la palabra más larga de la lista.
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static char *upper_word(const char *word) {
    char *copy = malloc(strlen(word) + 1);
    if (copy == NULL) {
        return NULL;
    }
    strcpy(copy, word);
    for (size_t i = 0; copy[i] != '\0'; i++) {
        copy[i] = (char) toupper((unsigned char) copy[i]);
    }
    return copy;
}

int main(void) {
    const char *words[] = {"puno", "ayacucho", "ica", "cajamarca", "lima"};
    char *longest = NULL;

    for (int i = 0; i < 5; i++) {
        char *upper = upper_word(words[i]);
        if (upper == NULL) {
            free(longest);
            return 1;
        }
        if (longest == NULL || strlen(upper) > strlen(longest)) {
            longest = upper;
        }
    }

    printf("%s\n", longest);
    free(longest);
    return 0;
}
