#include int main() { double p; // Probability of getting a rare character std::cout << "Enter the probability of getting a rare character (0 to 1): "; std::cin >> p; if (p <= 0 || p >= 1) { std::cout << "Invalid probability. Please enter a value between 0 and 1." << std::endl; return 1; } double expectedSpins = 1 / p; std::cout << "Expected number of spins until a rare character: " << expectedSpins << std::endl; return 0; }