本文主要是介绍UVA-10115 Automatic Editing,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
原题链接:
https://vjudge.net/problem/UVA-10115#author=Luke
AC代码:
#include <bits/stdc++.h>
using namespace std;int main()
{int n;while (cin >> n && n != 0){string s1[20];string s2[20];getchar();for (int i = 0; i < n; i++){getline(cin, s1[i]);getline(cin, s2[i]);}string str;getline(cin, str);for (int i = 0; i < n; i++){int index = 0;index = str.find(s1[i]);while (index != str.npos){str = str.replace(index, s1[i].length(), s2[i]);index = str.find(s1[i]);}}cout << str << endl;}return 0;
}
这篇关于UVA-10115 Automatic Editing的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!