# Indesign script to apply paragraph style to alternating paragraphs

I have an Indesign document with the following structure:

paragraph 1 blah blah blah blah blah blah blah blah

paragraph 2 blah blah blah blah blah blah blah blah

paragraph 3 blah blah blah blah blah blah blah blah

paragraph 4 blah blah blah blah blah blah blah blah

paragraph 5 blah blah blah blah blah blah blah blah

. . . and so on...

Now I need to leave the first paragraph as is but apply paragraph styles to all the subsequent paragraphs in the following pattern:

paragraph 2: style A

paragraph 3: style B

paragraph 4: style A

paragraph 5: style B

. . . and so on (alternating pattern)...

I know this can be automated using scripts and I also know a bit of programming in general (JavaScript) but I have no idea how to go about doing this in Indesign. Any suggestion?