prog examples for reversing a String and reversing a linked list