1 Star 0 Fork 0

OuroborosInc / OuroborosOJ-2021b

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
6.2 D 644 Bytes
一键复制 编辑 原始数据 按行查看 历史
vulcan626 提交于 2022-06-16 09:18 . Data-Structure-main
#include<iostream>
#include<stack>
using namespace std;
int main()
{
stack<char>s;
char ch0='a',ch1[8];
for(int i=0;i<7;i++)
cin>>ch1[i];
int i=0,flag=1;
while(i<7)
{
if(ch0==ch1[i])
{
ch0++;i++;
}
else if(!s.empty()&&s.top()==ch1[i])
{
s.pop();
i++;
}
else if(ch0<='g')
{
s.push(ch0);
ch0++;
}
else
{
flag=0;
break;
}
}
if(flag)
{
cout<<"True";
}
else
{
cout<<"False";
}
return 0;
}
C++
1
https://gitee.com/ouroborosinc/OuroborosOJ-2021b.git
git@gitee.com:ouroborosinc/OuroborosOJ-2021b.git
ouroborosinc
OuroborosOJ-2021b
OuroborosOJ-2021b
master

搜索帮助