int truncate(char *s, int n) {
    int p = strlen(s);
    if (p <= n) {
        return 0;
    }
    else {
        strncpy(s, s, n);
        int q = strlen(s);
        return p - q;
    }
}
change s to be s of length at most n