algorithm confusing
 
Caps