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.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Longest string in an array which matches with prefix of the given string
- Count the Number of matching characters in a pair of strings
- Find a string which matches all the patterns in the given array
- String matching where one string contains wildcard characters
- Meta Strings (Check if two strings can become same after a swap in one string)
- Given a string and an integer k, find the kth sub-string when all the sub-strings are sorted according to the given condition
- Longest string which is prefix string of at least two strings
- Number of sub-strings which are anagram of any sub-string of another string
- Sub-strings of a string that are prefix of the same string
- Different substrings in a string that start and end with given strings
- Frequency of a string in an array of strings
- Count of sub-strings of length n possible from the given string
- Count All Palindrome Sub-Strings in a String | Set 1
- Strings from an array which are not prefix of any other string
- Find all palindromic sub-strings of a given string | Set 2
- String from prefix and suffix of given two strings
- Given two strings, find if first string is a subsequence of second
- Count All Palindrome Sub-Strings in a String | Set 2
- Find if a string is interleaved of two other strings | DP-33
- All possible strings of any length that can be formed from a given string
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.