Another `perl` approach:

```
perl -Mopen=locale -lne '
 print 1+length$`, " ", 1+length$'\'' if /\p{Lu}(.*\p{Lu})?/'
```

- `\p{Lu}` matches an `u`pper case `L`etter.
- `` $` `` contains the part before the match, `$'` the part after the match
- with `-n` (`sed -n` mode), `perl` processes the input one line at a time with `$_` containing the line.
- with `-l`, the line delimiter is trimmed from the lines on input and added back on output (like `sed` does).
- with `-Mopen=locale`, the input is decoded into text as per the locale's encoding and encoded back on output. Without it, the input would be interpreted in the ISO8859-1 (aka latin1) charset.

In any case, note that `awk` or `sed` or `perl` are not *bash programs*, nor have they anything to do with any shell, other than like any command they can be invoked by any shell including `bash` or anything else that is not a shell for that matters.