A new device is being designed for all the post offices in Byteland. This device will make mail classification and delivery more efficient by automatically recognizing the addresses written on envelopes. You are responsible for the software component that determines if two addresses match.
Given two Strings address1 and address2, determine if they match using the following procedure. First, remove all spaces from both addresses. Then, perform a case-insensitive string comparison. If the two strings are equal, return -1. Otherwise, return the leftmost 0-based position at which they differ (the index after removing the spaces).
|