/*
Nome: Mario
Cognome: Montanari

removeDigit (come delDigit)
*/

#include <iostream>
#include <cctype>

#define SIZE 100+1

using namespace std;

char *removeDigit(char *const str);

int main(void) {
	char str[SIZE] = "H3ll0 W0rld! 2025";
	
	cout << "Before: " << str << endl;
	
	removeDigit(str);
	
	cout << "After: " << str << endl;
	
	return 0;
}

// Con puntatori
char *removeDigit(char *const str) {
	char *w = str;
	
	for (char *r = str; *r != '\0'; r++) {
		if (!isdigit(*r)) {
			*w++ = *r;
		}
	}
	
	*w = '\0';
	
	return str;
}

/* Senza puntatori
char *removeDigit(char *const str) {
	int w = 0;
	
	for (int r = 0; str[r] != '\0'; r++) {
		if (!isdigit(str[r])) {
			str[w++] = str[r];
		}
	}
	
	str[w] = '\0';
	
	return str;
}
*/