Skip to content

Commit 7cb6aa3

Browse files
Create Three Strings Explanation.txt
1 parent 0649793 commit 7cb6aa3

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
For each position i,
2+
3+
We must swap either (A[i], C[i]) or (B[i], C[i])
4+
5+
This means that either (B[i] = C[i]) or (A[i] = C[i]) respectively
6+
7+
-----
8+
9+
void solve()
10+
{
11+
string A, B, C;
12+
cin >> A >> B >> C;
13+
14+
for(int i = 0; i < A.size(); i++)
15+
{
16+
if(A[i] == C[i] || B[i] == C[i])
17+
{
18+
continue;
19+
}
20+
21+
cout << "NO\n";
22+
23+
return;
24+
}
25+
26+
cout << "YES\n";
27+
}

0 commit comments

Comments
 (0)