#include <stdio.h>
#include <string.h>

#define SIZE 100

int main(void)
{
    char string1[SIZE];
    char string2[SIZE];
    int characters;

    printf("Enter the first string: ");
    fgets(string1, SIZE, stdin);

    printf("Enter the second string: ");
    fgets(string2, SIZE, stdin);

    string1[strcspn(string1, "\n")] = '\0';
    string2[strcspn(string2, "\n")] = '\0';

    printf("Enter the number of characters to compare: ");
    scanf("%d", &characters);

    int result = strncmp(string1, string2, characters);

    if (result < 0)
    {
        printf("The compared part of the first string is less than the second.\n");
    }
    else if (result > 0)
    {
        printf("The compared part of the first string is greater than the second.\n");
    }
    else
    {
        printf("The compared parts of the two strings are equal.\n");
    }

    return 0;
}