#include <iostream> (30316)#include <cstring> using namespace std; int main() { string t = "";//剪切板 string s = "";//屏幕 string str; cin >> str; int len = str.size(), f = 0; //f表示是否被全选中 for(int i = 0; i < len; i++) { if(str[i]=='1'&&!f) s+="a"; else if(str[i]=='1'&&f) { s="a"; f = 0; } else if(str[i]=='2'&&f&&s.size()!=0) { t = s; } else if(str[i]=='3'&&f&&s.size()!=0) { t = s; s = ""; f = 0; } else if(str[i]=='4'&&!f) { s+=t; } else if(str[i]=='4'&&f) { s=t; f = 0; } else if(str[i]=='5'&&s.size()!=0) { f = 1; } } cout << s.size(); }
2

相关推荐

点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务