public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> list = new ArrayList<String>();
while (true) {
String s = reader.readLine();
if (s.isEmpty()) break;
list.add(s);
}
ArrayList<String> listEvenOdd = new ArrayList<String>();
for (int i = 0; i < list.size(); i++) {
String s = list.get(i);
if(list.get(i).length()%2==0){
listEvenOdd.add(_____________));
}
else{
listEvenOdd.add(______________);
}
}
for (int i = 0; i < listEvenOdd.size(); i++) {
System.out.println(listEvenOdd.get(i));
}
}
}
what should i have to do in __ position to print string three and two time as per given condition
Resolved
Comments (8)
- Popular
- New
- Old
You must be signed in to leave a comment
Khurram
1 October 2018, 17:22
String s is unused, try to use it
0
Shahanshah Alam
1 October 2018, 17:37
can
(s+s+s)
and
(s+s)
do work?
0
Khurram
1 October 2018, 17:41
it does
0
Shahanshah Alam
1 October 2018, 17:46
is does but i trapped again in printing space between them
0
Khurram
1 October 2018, 18:01
same way you display space in system.out.println function
0
Shahanshah Alam
1 October 2018, 18:02
(s+" "+s" "+s) ?
0
Khurram
2 October 2018, 03:33
try it out
0
WatWat
15 October 2018, 20:40
Watch your +'s, don't forget any
0