No one in Russia was in doubt about the outcome of Sunday’s presidential election. Vladi­mir Putin’s triumph was assumed. But there is feverish speculation, and great uncertainty, about what will happen beginning Monday, when Putin prepares to begin a new six-year term. The question of the moment in Moscow is: How long will he last?

Not long, according to some of the more fevered spokesmen of the surging opposition, who predict the swelling of post-election demonstrations. More sober analysts figure the strongman and his circle might hang on for a couple of more years, provided they choose to appease a disgruntled public with political and economic reforms.

The pessimists think Putin may survive for a full six years as president — but not for the second six he was clearly counting on when he announced his return to the job last September. Russians I spoke to in the past several weeks voiced a common refrain: The autocracy that dominated the country for the last decade is already dead. The only question is what will follow it, and when.

A similar observation can be made about another big and seemingly stable dictatorship: China. The well-orchestrated visit to the United States last month of ruler-in-waiting Xi Jinping was in keeping with the regime’s plan for a smooth transition of power over the next year — and a decade-long reign of Xi.

Yet even China’s own government planners say that the political stasis this implies is unworkable. In a remarkable new report co-written with the World Bank and released last week, technocrats at the Development Research Center of the State Council concluded that to sustain its economic growth in the next 20 years, “it is imperative that China adjusts its development strategy,” including by allowing free debate, establishing the rule of law and opening up the political process.

Since the beginning of the century, Russia and China have been constants in the world: autocratic, resistant to the spread of freedom, occasionally belligerent toward their neighbors and increasingly prosperous. Their rulers have supposed this will continue for another decade. But it’s becoming evident they are wrong.

Interestingly, Putin and his counterparts in Beijing have a common understanding of the source of the rising pressure on them. “Our society is completely different from what it was at the turn of the 20th century,” Putin wrote in an op-ed The Post published last month. “People are becoming more affluent, educated and demanding. The results of our efforts are new demands on the government and the advance of the middle class above the narrow objective of guaranteeing their own prosperity.”

Says “China 2030,” the World Bank-state planners collaboration: “The rising ranks of the middle class and higher education levels will inevitably increase the demand for better social governance and greater opportunities for participation in public policy debate and implementation. Unmet, these demands could raise social tensions.”

In other words, the emerging middle classes in China and Russia won’t tolerate exclusion from political decision making for another 10 years. In Moscow, the proof is already visible, in the crowds of tens of thousands who have turned out to denounce fraud in December’s parliamentary elections. In China, the evidence is all over Sina Weibo, the micro blogging site where people flock to sound off.

For these two big countries and the world around them, the big question is whether the inevitable change will come from inside or outside the current system. Putin could be another Gorbachev — or another Mubarak. Some people believe that he will slowly allow liberalization. But his conduct of the election campaign — founded on excluding opponents and bad-mouthing the United States — suggests otherwise. Xi has yet to take office, but has shown no sign of receptiveness to the reforms proposed by China 2030. Repression of pro-democracy dissidents has increased in the past several years.

Like the Arab Spring of the past year, the crumbling of the autocratic status quo in Russia and China will pose major challenges for the United States — the first of which is to recognize what is coming. For the past decade, U.S. policy toward the two countries has been based on acceptance of their denial of human rights, with occasional and pro-forma grumbles. To continue that regime-centered policy would be to make the same mistake that the Obama administration committed in clinging to the autocrats of the Middle East.

So as Putin and Xi take office, the question the administration should be pondering is not how to build — or “reset” — relations with them. It should be the point people are debating in Moscow: How long can he last?