Codeforces 1791A Codeforces Checking Solution & Explanation

Difficulty : 800

Problem Description

Given a lowercase Latin character (letter), check if it appears in the string codeforces.

Input

The first line of the input contains an integer t (1≤t≤26) — the number of test cases.

The only line of each test case contains a character c — a single lowercase Latin character (letter).

Output

For each test case, output “YES” (without quotes) if c satisfies the condition, and “NO” (without quotes) otherwise.

You can output the answer in any case (for example, the strings “yEs”, “yes”, “Yes” and “YES” will be recognized as a positive answer).

Examples

Input10
a
b
c
d
e
f
g
h
i
j
OutputNO
NO
YES
YES
YES
YES
NO
NO
NO
NO

Solution

The question assesses your ability to utilize the string.Contains method, recognizing that other languages may use different methods for the same purpose, such as array-based approaches.

C# Solution

Solution1

int t = int.Parse(Console.ReadLine());
string str = "codeforces";

for(int i=0; i<t; i++){
    var c = Console.ReadLine();
    Console.WriteLine(str.Contains(c)?"YES":"NO");
}
Klook.com

Conclusion

🧡If my solution helps, that is my honor!

🧡You can support me by sharing my posts, thanks you~~

✅If you got any problem about the explanation or you need other programming language solution, please feel free to let me know !!

The problem link : Problem – 1791A – Codeforces

Some Random Codeforces Posts

Leave a Reply

Your email address will not be published. Required fields are marked *