Write a function to perform string manipulation or array transformation.
Implement transform(value) so it returns the characters of a string or the elements of an array in reverse order. The input may be either a string or a JSON-style array, and the returned value must have the same type. Do not use the built-in reverse operation.
Signature: transform(value)
Examples: transform("BILL") returns "LLIB"; transform([1, 2, 3]) returns [3, 2, 1].
def transform(value):