1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ierofanga [76]
3 years ago
5

Write a Java program that generates a new string by concatenating the reversed substrings of even indexes and odd indexes separa

tely from a given string.

Computers and Technology
1 answer:
salantis [7]3 years ago
8 0

Answer:

/ReversedEvenOddString.java

import java.util.Scanner;

public class ReversedEvenOddString {

   public static void main(String[] args) {

       Scanner sc = new Scanner(System.in);

       String s = sc.nextLine();

       String evens = "";

       String odds = "";

       for(int i = s.length()-1;i>=0;i--){

           if(i%2==1){

               odds += s.charAt(i);

           }

           else{

               evens += s.charAt(i);

           }

       }

       String res;

       if(s.length()%2==1){

           res = evens+odds;

       }

       else{

           res = odds+evens;

       }

       System.out.println(res);

   }

}

You might be interested in
Can you shoot video on the Olympus E-410?
Masja [62]
Yes you must update or do something first but then you can
6 0
3 years ago
Read 2 more answers
You want to create a hyperlink within your document to the sec web site. which type of link do you create?
snow_lady [41]
An Existing file or web page. 
4 0
3 years ago
Which of the following is NOT a characteristic developed by New Journalism?
krok68 [10]
Flashy page layouts
7 0
3 years ago
Which can be used to plan a program?
Marina86 [1]

Answer:

Pseudocode.

Hope this helps you...

Explanation:

8 0
3 years ago
Read 2 more answers
3. The Central Processing Unit is made of
monitta

Answer:

a

Explanation:

jjwjwjwwjwjwjwjwjwj#k#kwkekee

4 0
2 years ago
Other questions:
  • Write a function, factors, that takes an integer n, and returns a list of values that are the positive divisors of n. Note: 0 is
    13·1 answer
  • If I put a short clip from a copyrighted video to Facebook and make it only viewable to friends, is that illegal?
    12·1 answer
  • Host A and B are directly connected with a 100 Mbps link. There is one TCP connection between the two hosts, and Host A is sendi
    14·1 answer
  • A marketing associate wants to use the Validate button to ensure an email is CAN-SPAM compliant. What information does the assoc
    5·2 answers
  • What conversion factor should be used to convert from meters to Gigameters?
    7·1 answer
  • _____ should be used to create a project schedule.
    14·1 answer
  • You are implementing a new application control solution. Prior to enforcing your application whitelist, you want to monitor user
    5·1 answer
  • Date
    6·1 answer
  • Cómo fue posible que los alemanes exterminando seres humanos​
    11·1 answer
  • Which network device sends data to every device that is connected to it?.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!