Given a string of lower case and uppercase characters, your task is to find the largest and smallest alphabet (according to ASCII values) in the string. Note that in ASCII, all capital letters come before all small letters.
Input : sample string Output : Largest = t, Smallest = a Input : Geeks Output : Largest = s, Smallest = G Explanation: According to alphabetical order largest alphabet in this string is 's' and smallest alphabet in this string is 'G'( not 'e' according to the ASCII value) Input : geEks Output : Largest = s, Smallest = E
The maximum possible value can be ‘z’ and smallest possible value can be ‘A’.
Largest and smallest alphabet is : s and E
This article is contributed by Sahil Rajput. 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 write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Program to find the product of ASCII values of characters in a string
- Program to find Smallest and Largest Word in a String
- Find the smallest window in a string containing all characters of another string
- Find largest word in dictionary by deleting some characters of given string
- Average of ASCII values of characters of a given string
- Count pairs of characters in a string whose ASCII value difference is K
- Count characters in a string whose ASCII values are prime
- Find the sum of the ascii values of characters which are present at prime positions
- Find number of substrings of length k whose sum of ASCII value of characters is divisible by k
- Lexicographically smallest string formed by appending a character from first K characters of a string | Set 2
- Lexicographically smallest string formed by appending a character from the first K characters of a given string
- Smallest window that contains all characters of string itself
- Largest sub-string where all the characters appear at least K times
- Swap all occurrences of two characters to get lexicographically smallest string
- Python | Get the smallest window in a string containing all characters of given pattern