304553: CF867A. Between the Offices
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Between the Offices
题意翻译
您可能知道,MemSQL 在旧金山和西雅图都设有美国办事处。作为公司的经理,你经常乘飞机往返于两个城市之间。你更喜欢从西雅图飞往旧金山,而不是另一个方向,因为旧金山比较暖和。你太忙了,以至于不记得你往任何一个方向飞了多少次。然而,对于最近的每一天,您都知道您是在旧金山办公室还是在西雅图办公室。你总是晚上坐飞机,所以你从来不会在同一天同时在两个办公室。根据这些信息,判断在过去的几天里你从西雅图飞往旧金山的次数是否更多。题目描述
As you may know, MemSQL has American offices in both San Francisco and Seattle. Being a manager in the company, you travel a lot between the two cities, always by plane. You prefer flying from Seattle to San Francisco than in the other direction, because it's warmer in San Francisco. You are so busy that you don't remember the number of flights you have made in either direction. However, for each of the last $ n $ days you know whether you were in San Francisco office or in Seattle office. You always fly at nights, so you never were at both offices on the same day. Given this information, determine if you flew more times from Seattle to San Francisco during the last $ n $ days, or not.输入输出格式
输入格式
The first line of input contains single integer $ n $ ( $ 2<=n<=100 $ ) — the number of days. The second line contains a string of length $ n $ consisting of only capital 'S' and 'F' letters. If the $ i $ -th letter is 'S', then you were in Seattle office on that day. Otherwise you were in San Francisco. The days are given in chronological order, i.e. today is the last day in this sequence.
输出格式
Print "YES" if you flew more times from Seattle to San Francisco, and "NO" otherwise. You can print each letter in any case (upper or lower).
输入输出样例
输入样例 #1
4
FSSF
输出样例 #1
NO
输入样例 #2
2
SF
输出样例 #2
YES
输入样例 #3
10
FFFFFFFFFF
输出样例 #3
NO
输入样例 #4
10
SSFFSFFSFF
输出样例 #4
YES