Created
October 7, 2022 01:15
-
-
Save webdevwilson/b7b304f8fc4c28e3740d85aa00656334 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestString { | |
public static void main(String... args) { | |
final String word = "timecomplexityn"; | |
System.out.println(word); | |
final String space = " ".repeat(word.length()-2); | |
for(int i = 1; i < word.length() - 1; i++) { | |
System.out.print(word.charAt(i) + space + word.charAt(word.length() - i) + "\n"); | |
} | |
System.out.println(new StringBuilder(word).reverse()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment