Created
March 19, 2016 05:51
-
-
Save jianminchen/6388585c990a42ea76ae to your computer and use it in GitHub Desktop.
Two string - using string.Contains function - simple
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
class Solution | |
{ | |
static void Main(String[] args) | |
{ | |
//for (int i = 97; i < 123; i++) | |
// Console.WriteLine((char)i); | |
//Console.ReadKey(); | |
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */ | |
int t = Convert.ToInt32(Console.ReadLine()); | |
for (int i = 0; i < t; i++) | |
{ | |
string a = Console.ReadLine(); | |
string b = Console.ReadLine(); | |
bool printYES = false; | |
for (int j = 97; j < 123; j++) | |
if (a.Contains(((char)j).ToString()) && b.Contains(((char)j).ToString())) | |
{ | |
printYES = true; | |
break; | |
} | |
Console.WriteLine(printYES ? "YES" : "NO"); | |
} | |
Console.ReadKey(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment