WICHITA, Kan. — A 22-year-old Wichita, Kansas, man who hiked 2,190 miles of the Appalachian Trail through 14 states is crediting God and Dr. Seuss for giving him the inspiration.

Joshua Gribble completed the Georgia-to-Maine, 158-day trek on Sept. 15, the Wichita Eagle (http://bit.ly/2dxmYhR ) reported.

Gribble said the motivation came from a 2015 church service in which he heard the pastor quote Dr. Seuss, “You’re off to great places! Today is your day! Your mountain is waiting! So get on your way!”

Gribble, an avid hunter and angler, considered that as God nudging him, then prepped for the hike for a year before launching it on April 10.

“Boredom was the biggest problem, because it can be so repetitive, mile after mile, day after day,” he said. “My dad came out and did about the first 200 miles with me. When he left, I was alone for about 400 miles. It got pretty lonely.”

Gribble also came upon friendly residents who hikers widely cast as “trail angels,” including one who let him to sleep in a barn out of the rain and fed him breakfast the next morning. But Gribble spent most nights in lean-tos often shared with other hikers, most of whom he described as “free-spirited hippie types” who “did nothing but smile.”

“Nothing could bring them down,” he said. “They really encouraged me and really gave me a lot of good advice and helped to keep me going.”

Along the way, Gribble, who hiked the final 900 miles with a Canadian he befriended, came across several rattlesnakes and a dozen black bears.

“I was hiking through the Shenandoah Mountains, with my head down and my headphones on, and when I looked up, there was a black bear walking right down the same trail towards me, no more than 10 yards away,” he said. “It would have made a heck of a cartoon. We stared at each other for a few seconds, then both turned and ran in the other direction.”

Gribble shivered through long, cold nights, hiked through “horrendous heat” and endured heavy hail.

“I’m sure the most important thing I learned is that I can deal with being miserable,” he said. “At first, you always want to stop, but I learned to force myself to smile and keep walking along.”

One day when Gribble’s fatigue and frustration mounted, he saw a hand-carved cross placed on the trunk of a tree deep in the wilderness, a ray of sunlight shining directly on it. Gribble said his body and mind instantly felt better.

And after one of the most difficult days of his hike, he checked into a hostel and saw a framed sign that read: “You’re off to great places! Today is your day! Your mountain is waiting! So get on your way!”

“It was my Dr. Seuss quote. I think it was there for a reason,” he recalled. “I knew from then on, everything was going to be OK.”

Information from: The Wichita (Kan.) Eagle, http://www.kansas.com