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
san4es73 [151]
3 years ago
10

Consider an array inarr containing atleast two non-zero unique positive integers. Identify and print, outnum, the number of uniq

ue pairs that can be identified from inarr such that the two integers in the pair when concatenated, results in a palindrome. If no such pairs can be identified, print -1.Input format:Read the array inarr with the elements separated by ,Read the input from the standard input streamOutput format;Print outnum or -1 accordinglyPrint the output to the standard output stream
Computers and Technology
1 answer:
Delvig [45]3 years ago
3 0

Answer:

Program.java  

import java.util.Scanner;  

public class Program {  

   public static boolean isPalindrome(String str){

       int start = 0, end = str.length()-1;

       while (start < end){

           if(str.charAt(start) != str.charAt(end)){

               return false;

           }

           start++;

           end--;

       }

       return true;

   }  

   public static int countPalindromePairs(String[] inarr){

       int count = 0;

       for(int i=0; i<inarr.length; i++){

           for(int j=i+1; j<inarr.length; j++){

               StringBuilder sb = new StringBuilder();

               sb.append(inarr[i]).append(inarr[j]);

               if(isPalindrome(sb.toString())){

                   count++;

               }

           }

       }

       return count == 0 ? -1 : count;

   }

   public static void main(String[] args) {

       Scanner sc = new Scanner(System.in);

       String line = sc.next();

       String[] inarr = line.split(",");

       int count = countPalindromePairs(inarr);

       System.out.println("RESULT: "+count);

   }

}

Explanation:

OUTPUT:

You might be interested in
What two names are given to the blinking vertical line?
Paha777 [63]

Answer:

<u>see </u><u>below</u><u>:</u>

Explanation:

One is (the cursor).

Whenever you see a flashing vertical line called-the cursor--you can start typing.Note that the mouse pointer is also called a cursor,but it is shaped differently.The keyboard cursor is also called the insertion point.

5 0
3 years ago
1.5 question 3 on edhesieve
morpeh [17]

Answer:

ppl

Explanation:

asfafgdffsghsdfghdgsghdfghtrbd54445 ddfgg

7 0
3 years ago
Michael works for a graphic design firm. He is creating an informative poster. He needs to add a great deal of text in the poste
Dennis_Churaev [7]

Michael will use a Adobe Photoshop or CorelDraw   tool to help format the text for creating an informative poster.

<h3>What application is used for graphic design?</h3>

They are:

  • Adobe Photoshop
  • Illustrator, GIMP
  • CorelDraw
  • Canva  and others

Based on the American Institute of Graphic Arts (AIGA), graphic design is known to be a term that is described as “the art and method of planning and bringing forth ideas and experiences along with the use of visual and textual content.”

Therefore, Michael will use a Adobe Photoshop or CorelDraw   tool to help format the text for creating an informative poster.

Learn more about graphic design from

brainly.com/question/27019704

#SPJ1

3 0
2 years ago
What number is needed to complete the pattern 66, 73, 13, 21, 52,_, 10, 20?
Lilit [14]
66,73 73-66=7
13,21 21-13=8
10,20 20-10=10

the missing no. is 9 so
52+9=61.

the pattern is
66,73,13,21,52,61,10,20





8 0
3 years ago
You want to set the sticky bit on an existing directory, subdir, without otherwise altering its permissions. to do so, you shoul
nikklg [1K]

If you want to set the sticky bit on an existing directory, subdir, without otherwise altering its permissions. to do so, you should type chmod a <u>t  <subdir>.</u>

<h3>What is Subdir?</h3>

The Definition of the term subdirectory is known to be a kind of an organizational directory that can be seen on a computer.

It is known to be one that can be found inside another directory  such as a subfolder. It is seen as the file a person is looking for and it is one that needs to have an extension.

Therefore, if you want to set the sticky bit on an existing directory, subdir, without otherwise altering its permissions. to do so, you should type chmod a <u>t  <subdir>.</u>

Learn more about directory from

brainly.com/question/14845522

#SPJ1

See full question below

You want to set the sticky bit on an existing directory, subdir, without otherwise altering its permissions. To do so, you should type:

chmod a+_____ <subdir>

- s

- p

- b

- t

6 0
2 years ago
Other questions:
  • I'm the state of Florida, your first conviction for DUI can result in your vehicle being impounded for
    5·1 answer
  • A ________ is a collection of forms, reports, queries, and programs that serves as an intermediary between users and database da
    6·1 answer
  • Write the method makeNames that creates and returns a String array of new names based on the method’s two parameter arrays, arra
    9·1 answer
  • Explain why professional software that is developed for a customer is not simply the programs that have been developed and deliv
    13·1 answer
  • Select the education and qualifications that are most helpful for business analysis careers. Check all that apply
    11·2 answers
  • Which of these are examples of a bug?
    6·1 answer
  • What is the full meaning of Internet and WiFi
    6·2 answers
  • Phân tích 5 phương hướng nhiệm vụ phát triển nông -lâm -ngư nghiệp ở nước ta hiện nay
    11·1 answer
  • How do you mark the brainiest?
    8·2 answers
  • Which access object cannot be used to enter or edit data
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!