Brain-Flak, 60 bytes
{({}<>)<>}<>{(({}<>)<>[({})]){((<{}>))}{}{({}<>{})(<>)}{}}<>
###Explanation:
Explanation:
{({}<>)<>}<> Reverse stack
{ While input exists
(
({}<>) Push copy of last element to the other stack
<>[({})] And subtract a copy of the next element
) Push the difference
{ If the difference is not 0
((<{}>)) Push two zeroes
}{} Pop a zero
{ If the next element is not zero, i.e the identical element
({}<>{}) Add the element to the copy of the previous element
(<>) Push a zero
}{} Pop the zero
}<> End loop and switch to output stack