An airshow squadron paints a distinct codename on every jet in the formation, and before each flyover the announcer reads out a proposed call sign for the whole squadron. The call sign is only considered valid if, read as one string, it exactly matches the first letter of every aircraft's codename, in formation order, with no letters skipped, added, or re-cased. Given the squadron's codenames and a proposed call sign, determine whether the call sign is valid.
Line 1: a single integer n, the number of aircraft in the squadron. Each of the next n lines contains one aircraft codename, a non-empty string of English letters. The final line contains the proposed call sign, a string of English letters.
Print true if the call sign equals the concatenation of the first character of each codename, taken in formation order, with matching case; print false otherwise.
1 <= n <= 100 1 <= length of each codename <= 10 1 <= length of call sign <= 100 All codenames and the call sign consist only of uppercase and lowercase English letters.
Example 1
Input
3 Falcon Osprey Raven FOR
Expected
true
Explanation
Falcon, Osprey, and Raven contribute first letters F, O, and R, which concatenate to "FOR" -- exactly the proposed call sign, so the answer is true.
Example 2
Input
3 Talon hawk Kite THK
Expected
false
Explanation
The first letters, taken in order and keeping their original case, are T, h, and K, concatenating to "ThK". Comparison is case-sensitive, so "ThK" does not equal the proposed "THK", and the answer is false.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →