Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need to accept a string literal and delete the first character of each word an

ID: 3930969 • Letter: I

Question

I need to accept a string literal and delete the first character of each word and append it to the end of each word using Java. For example:
User enters literal: Java is awesome
It should then output new literal: avaj si wesomea.
I've tried using string builder but, can't figure out how to do it. Thanks I need to accept a string literal and delete the first character of each word and append it to the end of each word using Java. For example:
User enters literal: Java is awesome
It should then output new literal: avaj si wesomea.
I've tried using string builder but, can't figure out how to do it. Thanks
User enters literal: Java is awesome
It should then output new literal: avaj si wesomea.
I've tried using string builder but, can't figure out how to do it. Thanks

Explanation / Answer

import java.util.*;
public class HelloWorld{

     public static void main(String []args){
         //declare required variables
         Scanner read=new Scanner(System.in);
         String input="",output="";
         //prompt the user for inout
        System.out.print("Enter string literal: ");
        input=read.nextLine();
        //split input based on spaces
        String token[]=input.split(" ");
      
        //iterate through each loop and fetch first character and append at last
        for(int i=0;i<token.length;i++)
        {
            output+=token[i].substring(1)+token[i].charAt(0)+" ";
        }
        System.out.println(output);
     }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote