#include <iostream>
#include <string>

int to_digit(char c) {
	if(c >= '0' && c <= '9') {
		return c-'0';
	}
	std::cerr << "[" << c << "] TO NIE CYFRA!11!!" << std::endl;
	return 0;
}

int to_number(std::string const &str) {
	try {
		return std::stoi(str);
	} catch(...) {}
	std::cerr << "[" << str << "] TO NIE LICZBA!11!!" << std::endl;
	return 0;
}

int main() {
	using namespace std;
	cout << to_digit('9') << endl;
	cout << to_digit('@') << endl;
	cout << to_number("-123") << endl;
	cout << to_number("-kappa") << endl;
	return 0;
}