My issue
My code
using System;
public class Test
{
public static void Main()
{
// your code goes here
}
}
Problem Link: WORDLE Problem - CodeChef
using System;
public class Test
{
public static void Main()
{
// your code goes here
}
}
Problem Link: WORDLE Problem - CodeChef
Hey this problem’s solution is easy. At first, let’s try to understand the problem. We are given two strings. 1st example: '“ABCDE” and the 2nd one is “EDCBA” . Now, we will match the characters located at the same index. If they are similar, we’ll change it with ‘G’. Here, index [0] = ‘A’, doesn’t match with 2nd string’s index[0] =‘E’. Replace it with ‘B’. Now, for code, we’ll take a new string containing five characters. And will replace the characters with a ‘G’ or ‘B’.
include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
string s,z;
cin>>s>>z;
string m="CCCCC";
for(int i=0;i<5;i++)
{
if(s[i]==z[i])
m[i] = 'G';
else if (s[i] != z[i])
m[i]='B';
}
cout<<m<<endl;
}
}
type or paste code here