BETA

Difficulty Level: Basic

Submissions: 446 Accuracy:

23.99%

Just One Mismatch
     

Given a string and array of strings, find whether the array contains a string with one character difference from the given string. Array may contain strings of different lengths.

Examples:

Input : str = "banana"
        arr[] = {"bana", "apple", "banaba", bonanzo", "banamf"}
Output :True
Explanation:Only one character difference between banana and banaba

Example : 
Input : 
The first line of input contains an integer T denoting the Test cases. Then T test cases follow. 
Second line contains No. of elements in arr[] - N
Third line contains a[i] elements
Fourth line contains string - str

Output : 
True if there is only one mismatch(by character), else False

Constraints :
1 ≤ T ≤ 50
1 ≤ N ≤ 100
1 ≤ arr[i] ≤ 1000

Input : 
1
4
gold flow cood code
cold

Output : 
True

 

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Mohit Gupta_OMG :D

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.