Question: Code java optimize Consider the following: A non - empty array, inarr of strings containing only lowercase alphabets Am 2 matrix of integers inmatrix

Code java optimize Consider the following:
A non-empty array, inarr of strings containing only lowercase alphabets
Am 2 matrix of integers inmatrix \table[["pip",{2,19},2,'p','s',"sis']]
The number of consonants in each of the replaced elements are:
\table[[inarr(after replacement),# of consonants,outstr],["apple",3,"guava"],["guava",2,],["pomegranate",6,],["sis",2,]]
1 Ingort jave.util. .
2
3 ciass midede
41
5
6
7
8
9
System.out
10
11such that:
the size of inarr is equal to m
the elements of inarr and the rows of inmatrix have oneto-one correspondence
each row of integers vec(i) and vec(j)' of inmatrix would be such that
.i is always less than the length of the corresponding string in inarr
'j' would always be less than 26inarr:
"apphe"
"goava"
"pomegranate"
"pip"
inmatrix:
3
1
8
2
1
import
java.util.
2
3
class mivCode
4
5
6
7
8
9
10
11
0
181+120
8
20
8
0
2
18
Perform the following operations:
For each string str in inarr and corresponding row of integers 'i' and of inmatrix, replace all the occurrences of the character at 'i'th index in str with the 'j'th element in the alphabet series Note: alphabet series -'a' would be the 0th element and 'z' would be the 25th element
Starting from leftmost replaced string from inarr, identify the first string with the minimum number of consonants and assignStarting from leftmost replaced string from inarr, identify the first string with the minimum number of consonants and assign it to outStr
Print outStr
Input Format:
First line contains inarr, with the elements separated by :''(comma)
Second line will contain number of rows m of inmatrix
The next m lines will contain the elements of inmatrix. Each line will have 2 elements separated by space.
Read the inputs from the standard input stream.
Output Format:Output Format:
Print outstr to the standard output stream
Sample inputs and outputs:
Sample Input:
apphe,goava,pomegranate, pip
4
31112080218
Sample Output:
guava
Explanation:
1.
i
java.util.:
2
3
class
UCode
4
5
6
7
8
9
10
11
public stataic
{
2.2?xplanation:
\table[[\table[[inarr(initial],[value)]],inmatrix values,\table[[value at],[index],[inmatrix],[[j]]],\table[[character],[in],[inarr to],[be],[replaced]],\table[[character],[to be],[replaced]],\table[[inarr(after],[replacemer]]],["apphe",{3,11},3,'h',I,"apple"],["goava",{1,20},1,'o','?',"guava"],[oomegranate",{8,0},8,?'a','a',pomegrana],["",{2,19},2,'p','s',sis"]]
1 import java.uti1."; 2
3
c.luss
m.Code
4
5
6
7
8
9
System.out. P
10
publif statie void
11}
e number of consonants in each of the replaced elements are:
 Code java optimize Consider the following: A non-empty array, inarr of

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!