KYIV, Ukraine — There are two important things to know about military trenches. First, you'll never find a soldier who likes to dig one. Second, the deeper they are, the safer they are.
"Digging a hole is not fun," said Stefan Korshak, an American who knows the Ukrainian military well. He's been living in Ukraine for 25 years and covers the war for the Kyiv Post.
"Their army has developed the discipline to make the soldiers dig holes, the moment they stop, wherever they are, anytime they could potentially be hit by Russian artillery. And that saves lives," said Korshak.
When Russia invaded Ukraine back in 2014, Ukraine's army was simply outmatched. Since then, Ukraine has had to figure out creative ways to defend itself and fight back, from low-tech to high-tech.
You could call them 'war hacks.' And many seem to be working.
Retired U.S. Army Lt. Gen. Ben Hodges has seen Ukraine's military improve first-hand. He became the commander of U.S. Army Europe shortly after that first Russian incursion.
As American troops helped train the Ukrainians, he was immediately struck by their tech savvy when the U.S. provided radar equipment that detected incoming Russian artillery fire.
"I quickly discovered that radar is better than I realized," said Hodges. "The Ukrainians took it and were able to use it in ways that I did not know were possible. And it's not just the technical part, but it's also the tactical, how they employed it."
He continued to be impressed by Ukrainian ingenuity in the years that followed.
"Then I saw where they were creating their own drones with a combination of military and off-the-shelf stuff," Hodges said in an interview from Germany, where he's now with the Center for European Policy Analysis.
In the current fighting, the Ukrainians are receiving U.S. and Turkish drones that have proved highly effective against Russian armor and troops.
Meanwhile, Ukrainian artillery units are using a network of computer tablets on the battlefield. This allows them to better coordinate their attacks on the Russians.
The previously outgunned Ukrainians now have huge howitzers recently delivered by the U.S., which has helped level the field to some extent. The Americans are also providing a week-long crash course in how to use them, having trained a couple hundred Ukrainian soldiers in recent weeks.
"I'm not surprised that they are doing very well getting new equipment, and how quickly they're able to learn to use it," said Hodges.
In the air war, Russia has far more fighter jets, which are a generation more advanced than the aging, Soviet-era MiG planes the Ukrainians are flying. Ukraine also has limited air defenses on the ground.
Russia was expected to destroy the Ukrainian air force within days. Instead, Ukraine says it's shot down 200 Russian aircraft. The Ukrainians have used shoulder-held Stinger missiles to take down low-flying helicopters, and the S-300 surface-to-air missile system to take down higher flying aircraft.
As a result, Russian pilots are often firing their missiles long distance — from the skies over Russia or the Black Sea — rather than venturing into Ukrainian air space.
"Our planes can't stand up technologically. It's obvious what the results of dogfights would be," said Lt. Col. Yuriy Ignat, spokesman for Ukraine's Air Force. "So we have to use what we have with maximal effectiveness. There's no alternative but to preserve our equipment and the lives of our pilots."
Russia was also expected to dominate the information war. Yet Ukraine has often been a step ahead. It cut off Russian-based cell phones that the Russians brought them into the country.
"You don't just switch off the roaming from a country, another country, overnight," said Cathal Mc Daid, an expert on mobile phone security with Adaptive Mobile Security in Ireland, who is closely monitoring the war. "You know, there's planning, a lot of planning. Feasibility planning goes in beforehand."
When the Russians started stealing Ukrainian cell phones, Ukrainian citizens reported the thefts. This allowed the Ukrainian officials to quietly listen in on the calls the Russians made on those stolen phones.
The Ukrainians, Mc Daid said, have learned many tricks from battling the Russians.
"I saw a great comment. You say 'an army marches on its stomach,' and somebody responded with a tweet saying, 'what an army now seems to march on is its mobile networks,'" said Mc Daid.
And, in the case of Ukraine, its ingenuity.
Greg Myre is an NPR national security correspondent. Follow him @gregmyre1.