Wherre are the adjacent characters in the title? [3, 4]!
Retina, 33 29 23 bytes
Saved 6 bytes thanks to Martin Ender
T`L`:`(.)\1+
:
$.`¶
T`L
Outputs a linefeed-separated list of indices.
Try it online!
Explanation
T`L`:`(.)\1+
Transliterate runs of the same character into colons, to mark positions where there are duplicate characters.
:
$.`¶
Then replace each colon with the length of the text before it, followed by a linefeed.
T`L
Finally, delete any remaining letters.
Jelly, 7 bytes
JṁŒgḊÐf
1-based; returns a list of lists of the runs of indexes as allowed by the OP.
Try it online!
How?
JṁŒgḊÐf - Main link: char-list s e.g. 'DCCABBBACCCD' (which is a python interpreted input of ['D','C','C','A','B','B','B','A','C','C','C','D'])
J - range(length(s)) [1,2,3,4,5,6,7,8,9,10,11,12]
Œg - group-runs(s) [['D'],['C','C'],['A'],['B','B','B'],['A'],['C','C','C'],['D']]
ṁ - mould left like right [[1],[2,3],[4],[5,6,7],[8],[9,10,11],[12]]
Ðf - filter keep items that would be truthy (empty is not truthy) after applying:
Ḋ - dequeue (x[1:]) [ [2,3], [5,6,7], [9,10,11] ]
Brain-Flak, 57 46 bytes
{({}[({})]<(([]<>)[()])>){(<{}{}{}>)}{}<>}<>
Includes +2 for -ar
Uses 0-based indexing.
Try it online!
# While true
{
# Subtract the second value on the stack from the first
({}[({})]
# Push the height of this stack (the main stack) on the other stack
<(([]<>)
# Push the height of the main stack - 1
[()])>
# Push the difference that we calculated a second ago
)
# If they weren't the same character
{
# Pop the difference and the two stack heights
(<{}{}{}>)
# End if
}
# Pop the difference (or the 0 to get out of the if)
{}
# Switch back to the main stack and end while
<>}
# Switch to the stack with the indexes and implicitly print
<>