Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- bool sprawdz(string n1, string n2, int dl)
- {
- int n = dl-1;
- int t1[3] = {0};
- int t2[3] = {0};
- for(int i=0;i<=dl/2;i++)
- {
- if(n1[i]=='A')t1[0]++;
- else if(n1[i]=='B')t1[1]++;
- else t1[2]++;
- if(n2[i]=='A')t2[0]++;
- else if(n2[i]=='B')t2[1]++;
- else t2[2]++;
- if(n>dl/2)
- {
- if(n1[n]=='A')t1[0]++;
- else if(n1[n]=='B')t1[1]++;
- else t1[2]++;
- if(n2[n]=='A')t2[0]++;
- else if(n2[n]=='B')t2[1]++;
- else t2[2]++;
- }
- n--;
- }
- for(int i=0;i<3;i++)
- {
- cout<<t1[i]<<t2[i]<<",";
- if(t1[i]!=t2[i])return false;
- }
- return true;
- }
- int main()
- {
- string n1 = "ACACCBC";
- string n2 = "ACCBBCA";
- int dl1 = n1.size();
- int dl2 = n2.size();
- if(dl1==dl2)cout<<sprawdz(n1,n2,dl1);
- else cout<<0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement