#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
vector<string*> spvec;
string str;
cout << "enter some strings : "<<endl;
while(cin >> str)
{
string *ptr = new string;
*ptr = str;
spvec.push_back(ptr);
/*spvec.push_back(&str);*/
}
vector<string*>::iterator iter = spvec.begin();
while(iter != spvec.end())
{
cout << **iter << (**iter).size() << endl;//这里不能缩写,因为连续两次对iter进行++操作了…………
iter++;
}
iter = spvec.begin();
while(iter != spvec.end())
{
delete *(iter++) ;//这里可以简化缩写~~
}
return 0;
}