//这题主要是两种左右引号比较难分清楚,只要将样例的copy下来,再通过键盘的尝试就容易得出!
#include <iostream>
#include <string>
using namespace std;
int main()
{
int len, i;
string str;
bool flag = true;
while (getline(cin, str)){
len = str.length();
for (i = 0; i < len; i++){
if (str[i] == '"' && flag == true){
cout << "``";
flag = false;
}
else if (str[i] == '"' && flag == false){
cout << "''";
flag = true;
}
else
cout << str[i];
}
cout << endl;
}
system("pause");
}
/*
"To be or not to be," quoth the Bard, "that
is the question".
The programming contestant replied: "I must disagree.
To `C' or not to `C', that is The Question!"
``To be or not to be,'' quoth the Bard, ``that
is the question''.
The programming contestant replied: ``I must disagree.
To `C' or not to `C', that is The Question!''
*/
poj 1488 TEX Quotes
最新推荐文章于 2022-02-25 19:38:17 发布