Two people are playing a game with a string ss, consisting of lowercase latin letters.

On a player's turn, he should choose two consecutive equal letters in the string and delete them.

For example, if the string is equal to "xaax" than there is only one possible turn: delete "aa", so the string will become "xx". A player not able to make a turn loses.

Your task is to determine which player will win if both play optimally.

Input

The only line contains the string ss, consisting of lowercase latin letters (1≤|s|≤1000001≤|s|≤100000), where |s||s| means the length of a string ss.

Output

If the first player wins, print "Yes". If the second player wins, print "No".

Examples
input

Copy
abacaba
output

Copy
No
input

Copy
iiq
output

Copy
Yes
input

Copy
abba
output

Copy
No
 #include <bits/stdc++.h>
 using namespace std;
 #define ll long long
 int main()
 {
     string str;
     stack<char> s;
     cin>>str;
     ;
     ;i<str.length();i++)
     {
         //判断是否为空一定要放在前面
         if(!s.empty() && str[i]==s.top())
         {
             num++;
             s.pop();
         }
         else{
             s.push(str[i]);
         }
     }
     ==)
     {
         cout<<"No"<<endl;
     }else{
         cout<<"Yes"<<endl;
     }
     ;
 }

CodeForces——Game with string(STL stack栈)的更多相关文章

  1. STL --> stack栈

    stack栈 c++stack(堆栈)是一个容器的改编,它实现了一个先进后出的数据结构(FILO),使用该容器时需要包含#include<stack>头文件: 定义stack对象示例: s ...

  2. [STL] stack 栈

    在出栈时需要进行两步操作,即先 top( ) 获得栈顶元素,再 pop( ) 删除栈顶元素

  3. STL - stack(栈)

    Stack简介 stack是堆栈容器,是一种"先进后出"的容器. stack是简单地装饰deque容器而成为另外的一种容器. #include <stack> stac ...

  4. STL之stack栈

    栈(statck)这种数据结构在计算机中是相当出名的.栈中的数据是先进后出的(First In Last Out, FILO).栈只有一个出口,允许新增元素(只能在栈顶上增加).移出元素(只能移出栈顶 ...

  5. STL stack 容器

    STL stack 容器 Stack简介 stack是堆栈容器,是一种“先进后出”的容器.      stack是简单地装饰deque容器而成为另外的一种容器.      #include <s ...

  6. stack栈

    栈(statck)这种数据结构在计算机中是相当出名的.栈中的数据是先进后出的(First In Last Out, FILO).栈只有一个出口,允许新增元素(只能在栈顶上增加).移出元素(只能移出栈顶 ...

  7. C#部分---特殊集合:stack栈集合、queue队列集合、哈希表集合。

    1.stack栈集合:又名 干草堆集合 栈集合 特点:(1)一个一个赋值 一个一个取值(2)先进后出实例化 初始化 Stack st = new Stack(); //添加元素用push st.Pus ...

  8. 容器vector的使用总结 容器stack(栈)

    0.头文件:#include<vector>; using namespace std; 1.定义: vector<type> vec; 2.迭代器 vector<typ ...

  9. Stack栈的三种含义

    理解stack栈对于理解程序的执行至关重要.easy混淆的是,这个词事实上有三种含义,适用于不同的场合,必须加以区分. 含义一:数据结构 stack的第一种含义是一组数据的存放方式,特点为LIFO,即 ...

随机推荐

  1. c结构体里的数组与指针

    /* 訪问成员数组名事实上得到的是数组的相对地址.而訪问成员指针事实上是相对地址里的内容 */ struct buf_str { int length; char buf[0]; }; struct ...

  2. SAM4E单片机之旅——8、UART初步

    通信还是比让LED灯闪烁实用得多的. 这次试试使用UART,实现开发版和PC间的通信.功能比较简单,就是把PC发向开发版的内容发送回去.这次主要介绍一下UART的配置,至于通信,则使用较为简单的不断查 ...

  3. SpringBoot-(6)-日志SLF4j

    一,日志简介: 目前有很多日志框架,SpringBoot内部采用了SLF4j+logback的形式. SpringBoot内部日志库依赖关系如下: 二,日志的分级 常用的Log日志分级如下: /* * ...

  4. 录音-树莓派USB摄像头话筒

    实测可用: sudo arecord --duration=10 --device=plughw:1,0 --format=cd aaa.wav sudo arecord --duration=10 ...

  5. PAT天梯赛 L2-027. 名人堂与代金券 【排序】

    题目链接 https://www.patest.cn/contests/gplt/L2-027 思路 在输入的时候 判断分数 是否符合领取代金券条件 如果符合 SUM 就加上对应的代金券价值 然后在对 ...

  6. platform_set_drvdata 和 platform_get_drvdata

    ndev是我们在probe函数中定义的局部变量,如果我想在其他地方使用它怎么办呢? 这就需要把它保存起来.内核提供了这个方法,使用函数platform_set_drvdata()可以将ndev保存成平 ...

  7. 在ubuntu16.04上编译android源码【转】

    本文转载自:http://blog.csdn.net/fuchaosz/article/details/51487585 1 前言 经过3天奋战,终于在Ubuntu 16.04上把Android 6. ...

  8. 在ubuntu 64位的机器上执行arm-linux-gcc提示 no such file or directory【转】

    本文转载自:http://blog.csdn.net/sno_guo/article/details/17059381 解压好了arm-linuxg-gcc 放到了$PATH路径下, 无论怎么执行都提 ...

  9. 人生苦短之Python多线程

    #encoding=utf-8 import threading import time ''' python多线程并不是真正意义上的多线程,通常我们所说的多线程是多个线程同时执行某功能,而在pyth ...

  10. zabbix 用户自定义监控参数添加

    1. item  key的添加 key可以带参数,该参数为一个数组列表,可以同时传递多个参数,key的格式如下 key -- [ parameters] -- 例如: vfs.fs.size[/] v ...