What will be the output of the following program?
import java.util.*;
public class RestInPeaceANR {
public static void main(String[] args) {
List<String> words = new ArrayList<String>();
words.add("Rest"); words.add("In"); words.add("Peace");
int index = 0;
for (String word : words) {
System.out.print(word + " ");
words.set(index++, word.toUpperCase());
}
Collections.reverse(words);
for (String word : words) {
System.out.print(word.charAt(--index));
}
}
}