mirror of
https://gitlab.gwdg.de/j.hahn02/university.git
synced 2026-01-01 14:54:25 -05:00
23 lines
379 B
C
23 lines
379 B
C
#include<stdlib.h>
|
|
#include<ctype.h>
|
|
#include<string.h>
|
|
|
|
void pop(char *s, char *p) {
|
|
int l = strlen(s) - 1;
|
|
for (int i = p - s; i < l; i++) s[i] = s[i+1];
|
|
s[l] = '\0';
|
|
}
|
|
|
|
int strclean(char *t) {
|
|
if (!t) return -1;
|
|
int count = 0, ind = 0;
|
|
while (t[ind] != '\0') {
|
|
if (!isgraph(t[ind])) {
|
|
pop(t, t + ind); count++;
|
|
} else ind++;
|
|
}
|
|
return count;
|
|
}
|
|
|
|
|