Just One Mismatch
Submissions: 551   Accuracy:


  Difficulty: Basic   Marks: 1

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.


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 : 
gold flow cood code

Output : 


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

Contributor: Mohit Gupta_OMG :D
Author: Mohit Gupta 4

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

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

to report an issue on this page.