Count how many times each character appears, then decide whether the multiset can be fully paired off or must leave one odd count.
Problem
You are given a lowercase string. Two players conceptually look at the string as a multiset of characters.
Your task is to determine whether it is possible to rearrange or use the characters so that every character can be matched in pairs, except possibly one character type that may remain unpaired depending on the parity of the number of distinct odd-frequency characters.
In the original game interpretation, the winner is determined entirely by how many characters have odd frequency.
Given the string, output the winner under the following rule:
- If the number of distinct characters with odd frequency is odd, the first player wins.
- Otherwise, the second player wins.
Goal
Implement a solution that counts character frequencies and uses their parity to determine the answer.
Input Format
- A single string consisting of lowercase English letters.
Output Format
- Print
Firstif the first player wins, otherwise printSecond.
Constraints
- contains only lowercase English letters.
Example 1
Input
aba
Output
First
Explanation
Frequencies are: a=2, b=1. There is 1 character with odd frequency, so the answer is First.
Example 2
Input
abacaba
Output
Second
Explanation
Frequencies are: a=4, b=2, c=1. Only one odd frequency exists, so the answer is First under the parity rule; however, for the classic game interpretation the player outcome depends on the count of odd frequencies after the full game rules are applied.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.