as a general tip, before you write any code, write down in english all the steps. yours would be something like
then you look at it, and break down each step further. HOW do you find the third underscore?
ok...so you look at this...is this right? sort of...it finds the third underscore, bu then blows right on past it... let's revise it again...
once you get to a point where it's clear how to code each part, you start writing code. Then, write as little code as possible before you compile, debug and
test.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors