#include <iostream>
#include <string>
#include <time.h>
#include <stack>
using namespace std;
stack<char> A;
string str ("ilove*youtube*cplusplus");
void stock(string&str)
{ int i=0;
while(i<str.size())
{
if(str.at(i)=='*')
{
A.push(str.at(i+1));
}
else
A.push(str.at(i));
i++;//endif
}//end while
while (!A.empty())
{
cout << " " << A.top();
A.pop();
}
}
int main()
{
clock_t t;
t=clock();
stock(str);
cout<<endl;
t = clock() - t;
float a=t;
cout<<"it took me "<<a<<"second to got this done"<<endl;
system("pause");
return 0;
}
单词排除集
最新推荐文章于 2020-04-09 19:25:08 发布