// // Created by cteam37 on 10/19/24. // #include #include #include using namespace std; bool isPrime(int num){ if(num < 2) return false; for(size_t i = 2; i < num; i++) { if(num%i == 0) { return false; } } return true; } set Primes (string input) { if(input.empty()) return {}; set maxPrimes = {}; for (int i = 0; i < input.size(); ++i) { string tmp; for (int j = 0; j < input.size(); ++j) { if(j==i) continue; tmp += input[j]; } set primes = Primes(tmp); if(primes.size() > maxPrimes.size()) maxPrimes = primes; } if(isPrime(stoi(input))) { maxPrimes.insert(stoi(input)); return maxPrimes; } return {}; } int main() { int i; cin >> i; string input = to_string(i); auto primes = Primes(input); for (auto x : primes) { cout << x << endl; } cout << primes.size() << endl; return 0; }