Given two strings s1 and s2, the task is to find whether the two string contain the same characters that occur in the same order. For example: string “Geeks” and string “Geks” contain the same characters in same order.
Input: s1 = “Geeks”, s2 = “Geks”
Input: s1 = “Arnab”, s2 = “Andrew”
Approach: We have two strings now we have to check whether the strings contain the same characters in the same order. So we will replace the contiguous similar element with a single element i.e. if we have “eee”, we will replace it with a single “e”. Now we will check that both the strings are equal or not. If equal then print Yes else No.
Below is the implementation of the above approach:
- Print common characters of two Strings in alphabetical order
- Python code to print common characters of two Strings in alphabetical order
- Check if the characters of a given string are in alphabetical order
- Check if lowercase and uppercase characters are in same order
- Check if string follows order of characters defined by a pattern or not | Set 3
- Check if string follows order of characters defined by a pattern or not | Set 2
- Check if string follows order of characters defined by a pattern or not | Set 1
- Check whether two strings can be made equal by copying their characters with the adjacent ones
- Strings formed from given characters without any consecutive repeating characters
- Test Case Generation | Set 2 ( Random Characters, Strings and Arrays of Random Strings)
- Print characters having odd frequencies in order of occurrence
- Print characters having even frequencies in order of occurrence
- Print characters and their frequencies in order of occurrence
- Print characters in decreasing order of frequency
- Meta Strings (Check if two strings can become same after a swap in one 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.