#include <iostream> #include <string> #include <cstdio> #include <cstdlib> #include <cstring> #include <cctype> #include <algorithm> #include <fstream> using namespace std; int n; char s1[105], s2[105]; int pr1, pr2, pl1, pl2; int main() { //ifstream cin("test.txt"); int i; cin>>n; cin.get(); while (n--) { cin.getline(s1, 105); cin.getline(s2, 105); for (i = 0; s1[i] != '<'; i++) cout<<s1[i]; pl1 = i; for (i++; s1[i] != '>'; i++) cout<<s1[i]; pr1 = i; for (i++; s1[i] != '<'; i++) cout<<s1[i]; pl2 = i; for (i++; s1[i] != '>'; i++) cout<<s1[i]; pr2 = i; for (i++; s1[i]; i++) cout<<s1[i]; cout<<endl; for (i = 0; s2[i] != '.'; i++) cout<<s2[i]; for (i = pl2 + 1; i < pr2; i++) cout<<s1[i]; for (i = pr1 + 1; i < pl2; i++) cout<<s1[i]; for (i = pl1 + 1; i < pr1; i++) cout<<s1[i]; for (i = pr2 + 1; s1[i]; i++) cout<<s1[i]; cout<<endl; } return 0; }
537 - Artificial Intelligence?
#include <iostream> #include <string> #include <cstdio> #include <cstdlib> #include <cstring> #include <cctype> #include <algorithm> #include <fstream> using namespace std; int n; string s; char res[5][100]; int main() { //ifstream cin("test.txt"); double U, I, P, scale; bool fu, fi, fp; cin>>n; int k = 1, i, j, p; cin.get(); while (n--) { fu = fi = fp = false; p = 0; cout<<"Problem #"<<k++<<endl; getline(cin, s, ' '); for (i = 0; s[i]; i++) { //if (i > 0 && s[i] == '=' &&(s[i - 1] == 'P' || s[i - 1] == 'I' || s[i - 1] == 'U')) if (s[i] == '=') { for (i--, j = 0; s[i] != 'V' && s[i] != 'A' && s[i] != 'W'; i++, j++) res[p][j] = s[i]; res[p][j] = '