# Wordle | codechef solution

## Problem

Chef invented a modified wordle.

There is a hidden word $�$ and a guess word $�$, both of length $5$.

Chef defines a string $�$ to determine the correctness of the guess word. For the ${�}^{�ℎ}$ index:

• If the guess at the ${�}^{�ℎ}$ index is correct, the ${�}^{�ℎ}$ character of $�$ is $\mathtt{\text{G}}$.
• If the guess at the ${�}^{�ℎ}$ index is wrong, the ${�}^{�ℎ}$ character of $�$ is $\mathtt{\text{B}}$.

Given the hidden word $�$ and guess $�$, determine string $�$.

### Input Format

• First line will contain $�$, number of test cases. Then the test cases follow.
• Each test case contains of two lines of input.
• First line contains the string $�$ - the hidden word.
• Second line contains the string $�$ - the guess word.

### Output Format

For each test case, print the value of string $�$.

You may print each character of the string in uppercase or lowercase (for example, the strings $\mathtt{\text{BgBgB}}$$\mathtt{\text{BGBGB}}$$\mathtt{\text{bgbGB}}$ and $\mathtt{\text{bgbgb}}$ will all be treated as identical).

### Constraints

• $1\le �\le 1000$
• $\mathrm{\mid }�\mathrm{\mid }=\mathrm{\mid }�\mathrm{\mid }=5$
• $�,�$ contain uppercase english alphabets only.

### Sample 1:

Input
Output
3
ABCDE
EDCBA
ROUND
RINGS
START
STUNT

BBGBB
GBBBB
GGBBG


### Explanation:

Test Case $1$: Given string $�=\mathtt{\text{ABCDE}}$ and $�=\mathtt{\text{EDCBA}}$. The string $�$ is:

• Comparing the first indices, $\mathtt{\text{A}}\mathrm{\ne }\mathtt{\text{E}}$, thus, $�\left[1\right]=\mathtt{\text{B}}$.
• Comparing the second indices, $\mathtt{\text{B}}\mathrm{\ne }\mathtt{\text{D}}$, thus, $�\left[2\right]=\mathtt{\text{B}}$.
• Comparing the third indices, $\mathtt{\text{C}}=\mathtt{\text{C}}$, thus, $�\left[3\right]=\mathtt{\text{G}}$.
• Comparing the fourth indices, $\mathtt{\text{D}}\mathrm{\ne }\mathtt{\text{B}}$, thus, $�\left[4\right]=\mathtt{\text{B}}$.
• Comparing the fifth indices, $\mathtt{\text{E}}\mathrm{\ne }\mathtt{\text{A}}$, thus, $�\left[5\right]=\mathtt{\text{B}}$.
Thus, $�=\mathtt{\text{BBGBB}}$.

Test Case $2$: Given string $�=\mathtt{\text{ROUND}}$ and $�=\mathtt{\text{RINGS}}$. The string $�$ is:

• Comparing the first indices, $\mathtt{\text{R}}=\mathtt{\text{R}}$, thus, $�\left[1\right]=\mathtt{\text{G}}$.
• Comparing the second indices, $\mathtt{\text{O}}\mathrm{\ne }\mathtt{\text{I}}$, thus, $�\left[2\right]=\mathtt{\text{B}}$.
• Comparing the third indices, $\mathtt{\text{U}}\mathrm{\ne }\mathtt{\text{N}}$, thus, $�\left[3\right]=\mathtt{\text{B}}$.
• Comparing the fourth indices, $\mathtt{\text{N}}\mathrm{\ne }\mathtt{\text{G}}$, thus, $�\left[4\right]=\mathtt{\text{B}}$.
• Comparing the fifth indices, $\mathtt{\text{D}}\mathrm{\ne }\mathtt{\text{S}}$, thus, $�\left[5\right]=\mathtt{\text{B}}$.
Thus, $�=\mathtt{\text{GBBBB}}$.
Code(c++):-
#include <iostream>
using namespace std;

int main() {
int t;
cin>>t;
while(t--)
{
string a,b,c="";
cin>>a>>b;
for(int i=0;a[i];i++)
{
if(a[i]==b[i])
c+="G";
else
c+="B";
}
cout<<c<<endl;
}
return 0;
}