We are given a string, we need check whether the first and last characters of the string str are equal or not. Case sensitivity is to be considered.
Input : university Output : Not Equal Explanation: In the string "university", the first character is 'u' and the last character is 'y', as they are not equal, "Not Equal" is the output. Input : racecar Output : Equal Explanation: In the string "racecar", the first character is 'r' and the last character is 'r', as they are equal, "Equal" is the output.
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.
- Python program to check if a string contains all unique characters
- Check whether two strings can be made equal by copying their characters with the adjacent ones
- Character whose frequency is equal to the sum of frequencies of other characters of the given string
- Minimum length String with Sum of the alphabetical values of the characters equal to N
- Count ways to partition a string such that both parts have equal distinct characters
- Check whether second string can be formed from characters of first string
- Program to check if all characters have even frequency
- Check if both halves of the string have same set of characters
- Quick way to check if all the characters of a string are same
- Check if a String contains any index with more than K active characters
- Check if both halves of the string have same set of characters in Python
- Check if a string is made up of K alternating characters
- Check if characters of one string can be swapped to form other
- Check if the characters of a given string are in alphabetical order
- Check whether the frequencies of all the characters in a string are prime or not
- Check if a given string is made up of two alternating characters
- Program to toggle all characters in a string
- Check if a string has all characters with same frequency with one variation allowed
- Check whether count of distinct characters in a string is Prime or not
- Check if string follows order of characters defined by a pattern or not | Set 2
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.