Welcome to the Ranch
Please have a look at the formatting of your code. You have too much on each line. You aren't using
{} after
if,
etc. Your variable names (digis, igits,
etc.) are confusing. That makes your code hard to read, and it is you who will have the most difficulty reading it. It makes it difficult to see the
+ 1 in line 14 which will cause you problems. It also makes it difficult for you to see that you aren't
testing whether you have 3 and 2 in line 26.
Reduce lines 26‑28 to something like,
See the old Sun
Style Guide.