[cpp] add rightmost char