Java Ete Practice Problems Set3
Java Ete Practice Problems Set3
Write a program that takes a string as input and reverses each word in the string while
maintaining the original order of the words.
Example:
Write a program that counts the number of vowels (a, e, i, o, u) in a given string, regardless of
their case.
Example:
Write a program that takes a string as input and removes any extra spaces between words,
ensuring that only a single space exists between them. Also, trim any leading or trailing spaces.
Example:
Write a function that, given a string, counts and returns the number of words that are anagrams
of a given word. A word in a string is separated by space(s).
Example:
Example:
Write a function that takes a string and an integer n, and rotates the string to the right by n
positions.
Example:
● Input: "abcdef", 2
● Output: "efabcd"
Write a program that, given a string, replaces the first and last character of each word with a
specified character.
Complete the function replaceFirstLastChar() that accepts a multi word string and a character,
replacing the first and last character of every word in it with the specified character.
Note: Every two adjacent words in the given string will be separated by exactly one space
character.
Example: