#include <stdio.h>
#include <string.h>
int main(void)
{
    char first[42], second[42], copy[41], joined[81];
    int comparison;
    if (fgets(first, sizeof first, stdin) == NULL) { puts("Enter two text lines."); return 1; }
    first[strcspn(first, "\n")] = '\0';
    if (strlen(first) > 40) { puts("Use at most 40 characters per line."); return 1; }
    if (fgets(second, sizeof second, stdin) == NULL) { puts("Enter two text lines."); return 1; }
    second[strcspn(second, "\n")] = '\0';
    if (strlen(second) > 40) { puts("Use at most 40 characters per line."); return 1; }
    strcpy(copy, first);
    strcpy(joined, first);
    strcat(joined, second);
    comparison = strcmp(first, second);
    printf("First length = %lu\nSecond length = %lu\n",
           (unsigned long)strlen(first), (unsigned long)strlen(second));
    printf("Copy = %s\nJoined = %s\n", copy, joined);
    printf("Comparison = %s\n", comparison < 0 ? "first comes before second" :
           comparison > 0 ? "first comes after second" : "equal strings");
    return 0;
}
