You are given two strings A and B. Strings also contains special character * . you can replace * with any alphabetic character. Finally, you have to tell whether it is possible to make both string same or not.
Input : A = "gee*sforgeeks" B = "geeksforgeeks" Output :Yes Input :A = "abs*" B = "abds" Output :No
Explanation: How we can solve above problem, Basically we three cases,
Case 1: Both string contains * at particular position, at that time we can replace both * with any character make the string equal at that position.
Case 2: If one string have character and other has * at that position. So, we can replace * with the same character in other string.
Case 3: If both the string has a character at that position, then they must be same, otherwise we can’t make them equal.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Longest string in an array which matches with prefix of the given string
- Find a string which matches all the patterns in the given array
- Count the Number of matching characters in a pair of strings
- String matching where one string contains wildcard characters
- Applications of String Matching Algorithms
- Meta Strings (Check if two strings can become same after a swap in one string)
- Number of sub-strings which are anagram of any sub-string of another string
- Print all words matching a pattern in CamelCase Notation Dictonary
- Longest Common Prefix using Word by Word Matching
- Longest Common Prefix using Character by Character Matching
- WildCard pattern matching having three symbols ( * , + , ? )
- Longest Common Prefix Matching | Set-6
- CamelCase Pattern Matching
- Dynamic Programming | Wildcard Pattern Matching | Linear Time and Constant Space
- Wildcard Pattern Matching
- Prefix matching in Python using pytrie module
- Pairs of complete strings in two sets of strings
- Number of common base strings for two strings
- Count of strings that become equal to one of the two strings after one removal
- Count of same length Strings that exists lexicographically in between two given Strings
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.