#include <stdio.h>
#include <stdlib.h>


// Implement a helper named check_permissions that matches the prototype below.
int check_permissions(char *input, char *required) {
        for (int i = 0; i < 9; i++) {
                if (required[i] != '-' && input[i] != required[i]) {
                        return 1;
                }
        }
        return 0;
}

int main(int argc, char** argv) {
        if (!(argc == 2 || argc == 3)) {
                fprintf(stderr, "USAGE: count_large size [permissions]\n");
                return 1;
        }

    // Process command line arguments.
        int result = 2;
        char permission[32];
        int size;
        int sum = 0;
        scanf("%*s %*s");
        if (argc == 2) {
                while (result == 2) {
                        result = scanf("%s %*s %*s %*s %d %*s %*s %*s %*s", permission, &size);
                        if (size > strtol(argv[1], NULL, 10)) {
                            sum += 1;
                        }
                }
                printf("%d\n", sum);
        }
        else {
                while (result == 2) {
                        result = scanf("%s %*s %*s %*s %d %*s %*s %*s %*s", permission, &size);
    // Call check_permissions as part of your solution to count the files to
    // compute and print the correct value.
                        if (check_permissions(permission, argv[2]) == 0 && size > strtol(argv[1], NULL, 10)) {
                                sum += 1;
                        }
                }
                printf("%d\n", sum);
        }
    return 0;
}

inspect the output from the ls -l command and print the number of files larger than a specified size