Write a program to find the remaining letter after striking out using the last stroke out character's value. Character value is nothing but 1 for A, 2 for B and so on. To start with cancel out the first letter.

As shown below for COREJAVA, first C is cancelled since it is the first letter, then J is cancelled since it is fourth letter (3 (value of C) + 1) from C, followed by R which is 11th letter (10 (value of J) + 1) from J and so on.

Note: Do not count already cancelled characters while moving.

Input (Character array) Output (Character)
['C', 'O', 'R', 'E', 'J', 'A', 'V', 'A'] `*OREJAVA // Always Cancel First Character*ORE*AVA // Move right by Last Cancelled Character Value ie. C or 3*O*E*AVA // Move right by Last Cancelled Character Value ie. J or 10*O*E*AV**O***AV******AV******A** // Repeat until only one character is presentOutput = A`
['D', 'O', 'T', 'N', 'E', 'T'] E
['H', 'I', 'B', 'E', 'R', 'N', 'A', 'T', 'E'] E
['P', 'E', 'R', 'L'] E
['D', 'A', 'B', 'C'] `*ABC // Cancel First Character D*A*C // Move right by D(or 4) positions*A** // Move right by B(or 2) positionsOutput = A`

``` class FindRemainingLetterAfterStrikingOut2 {    public static void main(String s[])    {        char input[] = {'C', 'O', 'R', 'E', 'J', 'A', 'V', 'A'};        System.out.println("The remaining letter is : " + getRemainingLetter(input));    } public static char getRemainingLetter(char[] input) { //Write code here to get the remaining letter after striking out as explained above. } } ```