Java Program to Find the First Capital Letter/Small Letter/Vowel/Consonant/Number/Whitespace/Special Character in a Given String

This is the Java Program to Find the First Capital Letter/Small Letter/Vowel/Consonant/Number/White Space/Special Character in a Given String. Problem Description Given a string, find the first position of the capital letter, small letter, vowel, consonant, whitespace, and special character if present in the string. Example: String x = “Ac @” Output = Capital letter = … Read more

advertisement

Java Program to Find the Length of Longest Repeating Sequence in a String

This is the Java Program to Find the Length of the Longest Repeating Sub-sequence in a String. Problem Description Given a string s, find and print the length of the longest repeating subsequence in the string, that is, the length of the subsequence consisting of some of the characters in the original string, which are … Read more

advertisement

Java Program to Convert a String to an Integer Array

This is the Java Program to Convert a String to an Integer Array. Problem Description Given a string consisting of various numbers separated by spaces, convert it into an array of Integers, such that every number occupies a position in the array, and for every invalid number, there is a -1 in the array. Example: … Read more

advertisement

Java Program to Reverse Each Word in a String

This is the Java Program to Reverse a String Word by Word in Place Problem Description Given a string, reverse each word in its place, where words are separated by whitespace. Example: String x = “We belong to Russia” Output = “eW gnoleb ot aissuR” Problem Solution Split the given string into various substrings, whenever … Read more

advertisement

Java Program to Check if Any Anagram of a String is Palindrome or Not

This is the Java Program to Check if Any Anagram of the String is a Palindrome Problem Description Given a string, check whether any of its anagrams is palindrome or not. An anagram is just a new word formed by permuting the letters of the string. Example: String x = “ACBDABD” Output = Yes Problem … Read more

advertisement

Java Program to Remove All Adjacent Duplicates from String

This is the Java Program to Delete Adjacent Pairs of Repeated Characters. Problem Description Given a string, find and remove all the adjacent pairs of repeated characters. Example: String x = “ABBCCCD” Output = “ACD” Problem Solution Create a stack and push the first character of the string on it. Now, iterate through the string, … Read more

advertisement

Java Program to Find the Longest SubString Without Any Repeated Characters

This is the Java Program to Find the Longest SubString Without Any Repeated Characters Problem Description Given a string, find and print the longest substring without any repeating characters, that is all the characters in the substring must be unique. Example: String x = “ABBCDFGHC” Output = “BCDFGH” Problem Solution Create a stack and push … Read more

advertisement

Java Program to Remove Characters from the Input String which are Present in the Mask String

This is the Java Program to Remove Characters that belong to a Mask String from the Input String Problem Description Given a string of characters and a mask string remove all the characters of the mask string from the first string. Example: String x = “We belong to Russia” Mask = “Wbos” Output = “e … Read more

advertisement

Java Program to Find the First Non-repeated Character in a String

This is the Java Program to Find the First non-repeated Character in a String Problem Description Given a string of characters, find the first non-repeated character in the string. Example: String x = “Hi this is Marry” Output = ‘H’ Problem Solution Make two new arrays to store the frequency of each character and the … Read more

advertisement

Java Program to Find the Largest and Smallest Word in a String

This is the Java Program to Find the Largest and Smallest Word Problem Description Given a string of characters, find the largest and the smallest word if two or more words are the largest or smallest then display the one that occurs first in the string. Example: String x = “We belong to Russia” Output … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.