有道云笔记中的数学公式插入比较烦人, 转换成markdown比较麻烦,用这个代码进行转换能稍微好一点.
#include<locale> #include<iostream> #include<string> #include<cstdio> using namespace std; string s, s2, s3("$"), s4("$$"); int main() { freopen("ans.out", "w", stdout); freopen("data.in", "r", stdin); bool flag = false; while(getline(cin, s)) { int zz = s.size() + 1; s2.clear(); for(int i = 0; i + 1 < zz;) { // if(s[i] == '`') cout << "!"; if(s[i] == '`' && s[i + 1] == '$') { i += 2; s2 += s3; } else if(s[i] == '$' && s[i + 1] == '`' ) { i += 2; s2 += s3; } else if(i + 6 < zz && s[i] == '`' && s[i + 3] == 'm' && s[i + 2] == '`' && s[i + 1] == '`' ) { flag = true; i += 7; s2 += s4; } else if(i + 2 < zz && s[i] == '`' && s[i + 1] == '`' && s[i + 2] == '`' && flag) { flag = false; i += 3; s2 += s4; } else { s2 += s[i]; i++; } } cout << s2 << "\n"; } }