时间限制:3.000秒
入门水题之一。
题目大意就是读入文本,要求把其中的英文双引号转换成对应的格式。英文双引号前后是没有区别的,而转换之后的双引号则是 ``' '的格式,所以需要特判一下。
#include <iostream>
#include <string>
using namespace std;
int main() {
string line;
int t = 1;
while(getline(cin, line)) {
for(string::iterator it = line.begin(); it != line.end(); ++it) {
if(*it == '"') {
if(t) cout << "``";
else cout << "''";
t = !t;
} else cout << *it;
}
cout << endl;
}
}