时间限制:1秒 内存限制:128M
题目描述
输入1行由字母和字符“#”组成的字符串,保证“#”出现偶次。
从前向后看,每两个“#”字符之间的字符串是要摘录的文字,请编程把摘录的字符串连续输出。
输入描述
1行字符串,总长度不超过1000000
输出描述
“#”号对之间的字符
样例
输入
a#abcd#xyz#efgh#opq
输出
abcdefgh
#include<cmath>
#include<queue>
#include<cctype>
#include<cstdio>
#include<string>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
int pos=0,flag=0;
string s,a;
cin>>s;
int l=s.size();
for(int i=0;i<=l;i++){
if(s[i]=='#'){
if(flag==0){
flag=1;
pos=i+1;
}
else{
flag=0;
a=a+s.substr(pos,i-pos);
}
}
}
cout<<a;
return 0;
}