Create a class StringProcess with the attributes string str (a string of characters) and len (the length of
the string). Write the constructor, getter, and setter methods. Write the following string processing
methods:
1. int letterCount(): returns the number of letters in the string.
2. int digitCount(): returns the number of digits in the string.
3. boolean isDigit(): checks if the string contains only digits.
4. boolean isLetter(): checks if the string contains only letters.
5. void concat(String s): concatenates the string with string s and prints the result.
6. void compareString(String s): compares the string with string s.
7. int search(char x): finds and returns the position of character x in the string.
8. int wordCount(): counts the number of words in the string.
9. void replace(char x, char y): replaces character x in the string with character y.
10. void format(): formats the string to lowercase, uppercase, and with the first character in
uppercase and the remaining characters in lowercase.
11. Finds and prints characters that appear more than once in the given string, case insensitive. If all
characters in the string are unique, print "NO". For example, the string "Java" has the character
'a' appearing more than once, and the string "JaVA" has the same result.
12. Checks if two strings are reverses of each other. If they are, print "OK"; otherwise, print "KO".
For example, "word" and "drow" are reverse strings.
13. Finds and prints the first character that appears only once in the string. If no such character
exists, print "NO".
14. Checks if a string contains any digits. If it does, print "false"; otherwise, print "true". Example:
"abc", "" => true
"1abc", "abc1", "123", "a1bc", null => false
15. Counts the number of vowels and consonants in the string. For example, the string "java" has 2
vowels ('a') and 2 consonants ('j', 'v').
16. Given a string str, replaces specified characters with a given character. For example,
"shareprogramming.net" replaces 'e' with '', resulting in "sharprogramming.n*t".
17. Reverses the characters of the string separated by spaces without using any library. For
example, "I am developer" => "developer am I". The characters should be separated by a single
space.
18. A palindrome is a string that reads the same forwards and backwards, such as "aba".
19. Given a string str, removes all characters that appear more than once, keeping only the first
occurrence. For example, "bananas" => "bans".
20. Finds the longest palindromic substring in a given string. A palindrome is a string that reads the
same forwards and backwards.
21. Finds the second most frequent character in the string. If there are multiple such characters,
print any one of them. Case insensitive. Example: "Successes" => "c"
22. Given two strings, concatenate them. If the strings are of unequal length, truncate characters
from the beginning of the longer string until they are of equal length, then concatenate. For
example, "Welcome" and "home" => "comehome".
23. Removes all adjacent duplicate characters from the string. For example, "aabaarbarccrabmq"
results in "brmq".
24. Given a string str and an integer n (n >= 0), divide the string into equal parts with n characters
each. If the string cannot be divided evenly, print "KO". Example:
"abcdefghijklmnopqrstuvwxy", n = 5 => "abcde fghij klmno pqrst uvwxy"