I would just like to ask, is there a way to possibly customize the way you reverse strings in java? For example, this is my sample input:
The big blue bird is flying.
is there any way that I can reverse some parts of the string like for example, by 3?
So the output would be:
Theib g beul bi dris ylfing .
The string is reverse every after 3 characters. is this possible?
Methodology: Iterate over all the characters of your input string by a parameter (e.g. in your case param=3) Determine the parts to be reversed with the help of a boolean flag. If the partial substring is not to be reversed append it to the result, otherwise append its reverse to the result with the help of a StringBuilder object. Give this code a try, I hope it helps: