It’s only when you reach middle school and get into the high-stress sport of competitive spelling that you can say “goddammit” and really mean it. So when the six anxious overachievers at the center of The 25th Annual Putnam County Spelling Bee shout out the profanity, it gets a hardy laugh from the crowd. Don’t get me wrong, this isn’t an offend-fest where every other word is a “shit” or a “fuck.” The naughty language is very sparse and TV-safe, but it’s an effective truth in this entertaining show in which adults playing kids who sometimes say bad words when they really mean it.

Spelling Bee is full of brilliant moments — a shining brilliance, not a smarty-pants brilliance. The script by Rachel Sheinkin starts with a spelling bee, something alien to most of us who can’t put a six-letter word together without spell check. In the midst of the insanity, you find amusing stories about the painful imperfections of adolescence, like errant boners, peanut allergies, and lisps.

And then there are the kids. They aren’t facing jocks or mean girls, yet. But they’ve got tiger moms, absent parents, broken homes, and pageant dads (well, spelling bee dads). Each of the students represents some form of the outcasts who are observed skeptically in middle school, harassed relentlessly in high school, and treasured in adulthood. In the spelling bee, they’re meeting their fellow oddballs in the same way you sort of stumbled on your own middle school buddies.

The cast easily navigates the comedy on the surface and the emotions just underneath. You realize they’ve captured the audience when Leaf Coneybear, played by Drew Archer, gets a word right and the audience applauds. It’s not the polite applause you give to a cast after the last note in a song. It is the proud applause you give a student when he gets a tough word right in a spelling bee. And that’s magic.

The dynamic duo of Stephanie S. Faatz (as Rona Lisa Peretti) and Lee Lewis (as Vice Principal Douglas Panch) provide terrific laughs as the moderators of the bee. Several of their jokes are at the expense of four audience members invited each night to participate in the bee. Celebrity guest Warren Pepper was a surprisingly strong speller on premiere night and a very good sport at the improvisational ribbing he received.

Once the audience volunteers are challenged with increasingly difficult words, the focus turns to the remaining students in the cast. The songs are largely forgettable, but the stories resonate. On the way back to the car, you won’t be humming “I’m Not That Smart,” “I Speak Six Languages,” or “The I Love You Song,” but you’ll think about your own childhood and the doubt, imperfection, and loneliness. More than anything else, Spelling Bee shows you can look back on those times and laugh … and laugh.