Codeforces Round 437 (Div. 2, based on MemSQL Start[c]UP 3.0 - Round 2)
A
Between the Offices
Codeforces
800
原题
←B →
翻译中…

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.

翻译中…

Input

翻译中…

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.

翻译中…

Output

翻译中…

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).

翻译中…

Note

翻译中…

In the first example you were initially at San Francisco, then flew to Seattle, were there for two days and returned to San Francisco. You made one flight in each direction, so the answer is "NO".

翻译中…

In the second example you just flew from Seattle to San Francisco, so the answer is "YES".

翻译中…

In the third example you stayed the whole period in San Francisco, so the answer is "NO".

翻译中…

In the fourth example if you replace 'S' with ones, and 'F' with zeros, you'll get the first few digits of $π$ in binary representation. Not very useful information though.

翻译中…

样例

Input #1
4
FSSF
Output #1
NO
InputCopy OutputCopy
Input #2
2
SF
Output #2
YES
InputCopy OutputCopy
Input #3
10
FFFFFFFFFF
Output #3
NO
InputCopy OutputCopy
Input #4
10
SSFFSFFSFF
Output #4
YES
InputCopy OutputCopy
题目信息
题号
867A
时间限制
2 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。