BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> s = new ArrayList<String>();
for(int a=0; a<10; a++)
{
s.add(b.readLine());
}
ArrayList<String> result = doubleValues(s);
for( String x: result)
{
System.out.print(x +" -> "+ x +" , ");
}
// Display result
}
public static ArrayList<String> doubleValues(ArrayList<String> s) {
//write your code here
//int ss = s.size();
for(int i=0; i<s.size(); i++)
{
s.add(i+1, s.get(i));
}
return s;
}
package com.codegym.task.task07.task0717;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
Duplicating words
*/
public class Solution {
public static void main(String[] args) throws Exception {
// Read strings from the console and declare an ArrayList here
BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> s = new ArrayList<String>();
for(int a=0; a<10; a++)
{
s.add(b.readLine());
}
ArrayList<String> result = doubleValues(s);
for( String x: result)
{
System.out.print(x +" -> "+ x +" , ");
}
// Display result
}
public static ArrayList<String> doubleValues(ArrayList<String> s) {
//write your code here
//int ss = s.size();
for(int i=0; i<s.size(); i++)
{
s.add(i+1, s.get(i));
}
return s;
}
}