?
package com.javarush.task.task07.task0716;
import java.util.ArrayList;
/*
Р или Л
*/
public class Solution {
public static void main(String[] args) {
ArrayList<String> list = new ArrayList<String>();
list.add("роза");
list.add("лоза");
list.add("лира");
list.add("волоса");
list.add("износа");
list = fix(list);
for (String string : list) {
System.out.println(string);
}
}
public static ArrayList<String> fix(ArrayList<String> list) {
//напишите тут ваш код
ArrayList<String> list2 = new ArrayList<String>();
for(int i = 0; i < list.size ; i++) {
if(list.get(i).conteins("л"))
{
if(list.get(i).contains("р")){
list2.add(list.get(i));
}
else {
list2.add(list.get(i));
list2.add(list.get(i));
}
}
else{
if(list.get(i).contains("р"))
list2.add(list.get(i));
}
}
return list2;
}
}