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.
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.
- Program to find the product of ASCII values of characters in a string
- Program to find the XOR of ASCII values of characters in a 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
- Program to find Smallest and Largest Word in a String
- Find number of substrings of length k whose sum of ASCII value of characters is divisible by k
- Find the sum of the ascii values of characters which are present at prime positions
- 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
- Sub-strings having exactly k characters that have ASCII value greater than p
- Convert all lowercase characters to uppercase whose ASCII value is co-prime with k
- Lexicographically smallest and largest anagrams of a string containing another string as its substring
- Hexadecimal equivalents in Binary Valued Graph
- Octal equivalents of connected components in Binary valued graph
- Decode an Encoded Base 64 String to ASCII String
- Convert Hexadecimal value String to ASCII value String
- 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