Problem:
Score : 500 points

Problem Statement

There is a string s of length 3 or greater.
No two neighboring characters in s are equal.

Takahashi and Aoki will play a game against each other.
The two players alternately performs the following operation, Takahashi going first:

Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.

The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.

Constraints

3 ≤ |s| ≤ 10^5

s consists of lowercase English letters.

No two neighboring characters in s are equal.

Input

The input is given from Standard Input in the following format:

s

Output

If Takahashi will win, print First. If Aoki will win, print Second.

Sample Input 1

aba

Sample Output 1

Second

Takahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.

Sample Input 2

abc

Sample Output 2

First

When Takahashi removes b from s, it becomes ac.
Then, Aoki cannot perform the operation, since there is no character in s, excluding both ends.

Sample Input 3

abcab

Sample Output 3

First

Solution in Rust (1.15.1) (judge verdict: Time Limit Exceeded)

use std::io::{ self, Write };
use std::str::FromStr;
use std::cmp::{ min, max };
use std::collections::{ BinaryHeap, HashMap, VecDeque };

macro_rules! trace {
    ($var:expr) => ({
        let _ = writeln!(&mut std::io::stderr(), ">>> {} = {:?}", stringify!($var), $var);
    })
}
macro_rules! swap { ($a:expr, $b:expr) => ({ let t = $b; $b = $a; $a = t; }) }

fn regular(cs: &Vec<u8>) -> Vec<u8> {
    let mut to = HashMap::new();
    let n = cs.len();
    let mut ds: Vec<u8> = Vec::with_capacity(n);
    let mut i = 0;
    for c in cs.iter() {
        if let Some(&d) = to.get(&c) {
            ds.push(d)
        } else {
            ds.push(i);
            to.insert(c, i);
            i += 1;
        }
    }
    ds
}

fn energy(cs: &Vec<u8>, mut memo: &mut HashMap<Vec<u8>, u8>) -> u8 {
    let ds = regular(&cs);
    let n = cs.len();
    if let Some(&ans) = memo.get(&ds) {
        return ans;
    }

    if n == 3 {
        if cs[0] == cs[2] {
            memo.insert(ds, 0);
            return 0;
        } else {
            memo.insert(ds, 1);
            return 1;
        }
    }

    for i in 1..(n - 1) {
        if cs[i-1] != cs[i+1] {
            let mut ds = Vec::with_capacity(n-1);
            for j in 0..i { ds.push(cs[j]); };
            for j in (i+1)..n { ds.push(cs[j]); };
            if energy(&ds, &mut memo) == 0 {
                memo.insert(ds, 1);
                return 1;
            }
        }
    }

    memo.insert(ds, 0);
    return 0;
}

fn main() {
    let mut sc = Scanner::new();
    let s: String = sc.cin();
    let cs = s.into_bytes();
    // println!("{:?}", cs);
    let mut hs = HashMap::new();
    let e = energy(&cs, &mut hs);
    println!("{}", if e == 0 { "Second" } else { "First" });
}

#[allow(dead_code)]
struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn reserve(&mut self) {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        self.reserve();
        match self.buffer.pop_front().unwrap().parse::<T>() {
            Ok(a) => a,
            Err(_) => panic!("parse err")
        }
    }
    fn get_char(&mut self) -> char {
        self.reserve();
        let head = self.buffer[0].chars().nth(0).unwrap();
        let tail = String::from( &self.buffer[0][1..] );
        if tail.len()>0 { self.buffer[0]=tail } else { self.buffer.pop_front(); }
        head
    }
}