Created
March 19, 2016 01:46
-
-
Save jianminchen/cdba6a97769db30c2e76 to your computer and use it in GitHub Desktop.
Two strings - IEnumerable - interesting to read the code
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.Linq; | |
class Solution { | |
static void Main(String[] args) { | |
int inputCnt = Convert.ToInt32 (Console.ReadLine ()); | |
if (inputCnt < 1 || inputCnt > 10) return; | |
string A, B; | |
IEnumerable<char> res; | |
bool[] output = new bool[inputCnt]; | |
for (int i = 0; i < inputCnt; i++) { | |
A = Console.ReadLine (); | |
B = Console.ReadLine (); | |
res = A.Intersect (B); | |
foreach (var elem in res) { | |
output[i] = true; | |
break; | |
} | |
} | |
foreach (var elem in output) { | |
if (elem) Console.WriteLine ("YES"); | |
else Console.WriteLine ("NO"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment