word of lowercase English letters. Count the contiguous non-empty pieces of it whose first and last letters are the same.
Pieces are told apart by position: two pieces with the same text at different places are counted twice. A single letter counts as a piece too.word="radar" → 7
Five one-letter pieces, plus "ada" (ends a…a) and the whole "radar" (ends r…r). That makes 7.
word="bbb" → 6
Every piece works: three of length one, two of length two, one of length three, so 6.
word="xyz" → 3
word contains only lowercase English lettersword="radar"
7
Run checks the first 3 tests in your browser. Submit checks all 81 tests on the server, hidden ones included.