Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Unwrapped = Wrap == app
- Eliminated = Eliminate == mate
- Encrypted = Crypt == cry
- Drawing = Draw == wing
- Possibilities = Possible == pistol
- */
- public class substr
- {
- public static void main(String[] args)
- {
- //INTIALIZATION
- String word1 = "Unwrapped";
- String word2 = "Eliminated";
- String word3 = "Encrypted";
- String word4 = "Drawing";
- String word5 = "Possibilities";
- //GET ROOT WORD
- String root1 = word1.substring(2,6);
- String root2 = word2.substring(0,9);
- String root3 = word3.substring(2,7);
- String root4 = word4.substring(0,4);
- String root5 = word5.substring(0,6) + word5.charAt(7) + word5.charAt(11);
- //MAKE ANOTHER WORD
- String anot1 = word1.substring(4,7);
- String anot2 = word2.charAt(3) + word2.substring(6,9);
- String anot3 = word3.substring(2,5);
- String anot4 = word4.substring(3,7);
- char anot5[] = {word5.charAt(0), word5.charAt(4) ,word5.charAt(2) ,word5.charAt(9), word5.charAt(1), word5.charAt(7)};
- //Converts char to String
- String anotVert = new String(anot5);
- //OUTPUT
- System.out.printf("\nThe root word of %s is : %s, Another word is: %s", word1, root1, anot1);
- System.out.printf("\nThe root word of %s is : %s, Another word is: %s", word2, root2, anot2 );
- System.out.printf("\nThe root word of %s is : %s, Another word is: %s", word3, root3, anot3 );
- System.out.printf("\nThe root word of %s is : %s, Another word is: %s", word4, root4, anot4 );
- System.out.printf("\nThe root word of %s is : %s, Another word is: %s", word5, root5, anotVert );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement