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. 关于mongorc.js文件详解

    最近阅读了<<mongodb权威指南第二版>>,发现这本书比之前的第一版好,很多地方讲解很详细.下面就翻译下谈下这个文件. 首先,启动shell的时候,mongorc.js文件 ...

  2. ffmpeg编码常见问题排查方法

    播放问题排查: 一旦我们遇到视频播放不了,第一件事,就是要找几个别的播放器也播放看看,做一下对比测试,或者对码流做一些基础分析,以便更好的定位问题的源头,而各个平台比较常见的播放/分析工具有如下几个: ...

  3. ESXi 5.5 RTL9168E网卡驱动 找到网卡

    如果你对专业服务器的价格望而却步,恰巧又想在普通的PC上安装ESXi,恰巧又是ESXi 5.5版本,那么这篇文章中提及的问题你可能会遇到,并能给你提供一些帮助. 1.成功安装重启以后提示“no boo ...

  4. define tensorflow and run it

    import tensorflow as tf a, b, c, d, e = tf.constant(5, name='input_a'), tf.constant(6, name='input_b ...

  5. React深入源码--了解Redux用法之Provider

    在Redux中最核心的自然是组件,以及组件相关的事件与数据流方式.但是我们在Redux中并没有采用传统的方式在getInitialState()中去初始化数据,而是采用Provider统一处理,省去了 ...

  6. mybatis是什么?(二)

    mybatis是什么? mybatis是一个持久层的框架,是apache下的顶级项目. mybatis托管到goolecode下,再后来托管到github下(https://github.com/my ...

  7. Jquery AJAX如何使用Promise/Deferred实现顺序执行?

    有的时候有我有N个AJAX请求,第下个请求可能要依赖上个请求的返回值, 可以用 $.ajax("test1.php").then(function(data) { // data ...

  8. SVN版本控制中.a无法提交问题

    1.首先xcode是默认忽略.a文件的.改变方法如下: 1⃣️. 打开终端,  在命令行中输入: vi ~/.subversion/config  来打开配置文件.2⃣️. 然后, 在[miscell ...

  9. Docker容器的数据卷(data volume),数据卷容器,数据卷的备份和还原。

    Docker容器的数据卷(data volume),数据卷容器,数据卷的备份和还原. 数据卷就是数据(一个文件或者文件夹). Docker的理念之一是将应用与其运行的环境打包,docker容器的生命周 ...

  10. LuNamp和LuManager的目录结构

    /|---- etc/|-------- my.cnf #mysql配置文件|-------- ipfw.conf #ipfw防火墙的配置文件(仅FreeBSD)|---- home/|------- ...