Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _USE_MATH_DEFINES
- #include <string>
- #include <algorithm>
- #include <cmath>
- #include <iomanip>
- #include <fstream>
- #include <deque>
- #include <vector>
- #include <utility>
- using namespace std;
- int main()
- {
- ifstream in("input.txt");
- ofstream out("output.txt");
- char masa[100][100];
- char masb[100][100];
- int n, m,count = 0;
- in >> n >> m;
- string s1,s2;
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++) {
- in >> masa[i][j];
- }
- }
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++) {
- in >> masb[i][j];
- }
- }
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++) {
- if (masa[i][j] != '.') {
- if (masa[i][j] != masb[i][j]) {
- count++;
- if (islower(masa[i][j])) {
- s2.push_back(masa[i][j]);
- }
- else {
- s1.push_back(masa[i][j]);
- }
- }
- }
- }
- }
- out << count << endl;
- sort(s1.begin(), s1.end());
- sort(s2.begin(), s2.end());
- out << s2 << s1;
- out.close();
- in.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement