/********************************
* 2012/07/03 *
* AOJ Volume0 0084 *
* Search Engine *
* crane *
*********************************/
#include<iostream>
#include<string>
#include<queue>
using namespace std;
string str;
int main(){
getline(cin,str);
queue<char> tmp;
queue<char> que;
int count_t = 0;
int count_q = 0;
bool frag = false;
for(int i=0; i<str.length(); i++){
char c = str.at(i);
if(c == ' ' || c=='.' || c==','){
if( 2<count_t && count_t < 7){
if(frag == true){
que.push(' ');
count_q++;
}
frag = true;
for(int i=0; i<count_t; i++){
que.push(tmp.front());
tmp.pop();
count_q++;
}
}else{
for(int i=0; i<count_t; i++){
tmp.pop();
}
}
count_t=0;
}else{
tmp.push(c);
count_t++;
}
}
for(int i=0; i<count_q; i++){
cout << que.front();
que.pop();
}
cout << "\n";
return 0;
}
0 件のコメント:
コメントを投稿