参考:https://blog.csdn.net/lianai911/article/details/41831645

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
const int N=1e5+;//若在函数内开过大数组,会显示Process returned -1073741571 (0xC00000FD)错误!
string s;
vector<char> v[*N];
int main()
{
std::ios::sync_with_stdio(false);//加快cin,cout效率
std::cin.tie();
// freopen("btext.txt","r",stdin);
while (cin>>s)
{
int st=N,h=N-,e=N+;//st为当前光标,h为头,e为尾
for (int i=;i<*N;i++)
{
v[i].clear();
}
for (unsigned int i=;i<s.length();i++)
{
if (s[i]=='[')
{
st=h;
h--;
continue;
}
if (s[i]==']')
{
st=e;
e++;
continue;
}
v[st].push_back(s[i]);
}
for (int i=h;i<=e;i++)
{
for (unsigned int j=;j<v[i].size();j++)
{
cout<<v[i][j];
}
}
cout<<endl;
} return ;
}

最新文章

  1. Google C++单元测试框架GoogleTest---Google Mock简介--概念及基础语法
  2. JSon转化为DaTable
  3. Counterfeit Dollar -----判断12枚钱币中的一个假币
  4. html5调用手机相机并压缩、上传
  5. sp转dp dp转px
  6. 总结Selenium自动化测试方法(三)WebDriver定位元素方法
  7. php做站点购物车 你搞懂了吗?
  8. iOS MBProgressHUD 之带底板的加载提示
  9. MySQL数据备份方法
  10. Nginx正反向代理、负载均衡等功能实现配置
  11. Python机器学习笔记:深入理解Keras中序贯模型和函数模型
  12. 面试 -- requestLayout、invalidate与postInvalidate区别
  13. thinkphp5 列表页数据分页查询-带搜索条件
  14. 安装vs2008出现MSI returned error code 1603的错误的解决
  15. oracle long类型转换成varchar2
  16. elixir二进制模式匹配
  17. 智慧树mooc自动刷课代码
  18. [BZOJ4061][Cerc2012]Farm and factory
  19. Springboot监控之一:SpringBoot四大神器之Actuator之2--springboot健康检查
  20. leetcode104 Maximum Depth

热门文章

  1. c#利用三层架构做一个简单的登录窗体
  2. 屏幕  z
  3. 我的HTML总结之常用基础便签
  4. c++中的const用法(很详细)——转
  5. vuejs 开发中踩到的坑
  6. 【洛谷P2921】[USACO08DEC]在农场万圣节
  7. Android学习笔记_72_Spinner的用法
  8. 导航栏的ul中的li设置问题
  9. webpack——概念的引入
  10. update、commit、trancate,delete