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.
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Program to find the XOR of ASCII values of characters in a string
- 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 Kth largest string from the permutations of the string with two characters
- Find largest word in dictionary by deleting some characters of given string
- Find the most valued alphabet in the String
- Average of ASCII values of characters of a given string
- Count characters in a string whose ASCII values are prime
- Count pairs of characters in a string whose ASCII value difference is K
- 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 the first K characters of a given string
- Lexicographically smallest string formed by appending a character from first K characters of a string | Set 2
- Smallest window that contains all characters of string itself