An Ordinary Game


Time limit : 2sec / Memory limit : 256MB

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|≤105
  • 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

Copy
aba

Sample Output 1

Copy
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

Copy
abc

Sample Output 2

Copy
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

Copy
abcab

Sample Output 3

Copy
First

//有一个字符串,相邻的不能相同,两个人玩,一人每次可以删除除了首尾的任意一个,但是要保证删完不能相邻的相同,谁删到不能删就谁输,
给一个字符串,问谁赢
 #include <stdio.h>
#include <string.h> char str[];
int main()
{
while (scanf("%s",str)!=EOF)
{
int len=strlen(str);
int res;
if (str[]==str[len-])
res=len-;
else
res=len-;
if (res%==)
printf("First\n");
else printf("Second\n");
}
return ;
}

最新文章

  1. JavaScript的作用域和块级作用域概念理解
  2. 平衡二叉树AVL
  3. jQuery extend方法使用及实现
  4. linux内存分配
  5. 芯航线FPGA学习套件之多通道串行ADDA(TLV1544,TLC5620)模块测试手册
  6. springMVC基础
  7. JPA学习(1)基础认知
  8. 转:Web App开发入门
  9. Java对象转xml报文和xml报文转Java对象帮助类
  10. -WEBKIT-USER-SELECT:NONE导致输入框无法输入
  11. java transient简介
  12. VC操作Excel之基本操作
  13. ASP.NET Application,Session,Cookie和ViewState等对象用法和区别 (转)
  14. Nothing
  15. JNI测试-java调用c算法并返回java调用处-1到20阶乘的和
  16. C# WinForm 和 javascript进行交互 使用HTML做界面
  17. OpenStack_I版 1.准备过程
  18. HTML学习笔记:2.基础语法
  19. 【HDFS API编程】图解客户端从HDFS读数据的流程
  20. [转]【docker】CMD ENTRYPOINT 区别

热门文章

  1. Bean的作用域scope
  2. ionic准备之angular基础——run方法(4)
  3. Linux组件封装(二)中条件变量Condition的封装
  4. python——变量作用域及嵌套作用域
  5. Android应用程序快速更换包名的方法
  6. JavaScript 数组去重 方法汇总
  7. Jeewx 捷微管家操作配置文档(开源版本号)
  8. Jmeter返回org.apache.http.NoHttpResponseException: The target server failed to respond解决办法
  9. C# 写日志到文件
  10. Java GUI编程SwingUtilities.invokeLater作用