Write a Java definition of function isPrefix(s, t),
which produces true if string s is a prefix of string
t. For example, isPrefix("rab", "rabbit")
should be true. According to our definition, a string is considered
to be a prefix of itself. So
isPrefix("rabbit", "rabbit")
should also be true.
(Hint: Just get a substring from the beginning of
t that has the same length as s, and see if it is
equal to s. Be careful, since it is possible that s
is longer than t. Do not ask for an index in t that
is too large.)