I have a task, and I need to make the code take in a user inputted word, put it in capital letters, reverse and it output it. This is my code so far, but I really have no clue how I do it.
import java.util.Scanner;
public class WordSizeChecker {
public static void main(String[] args) {
Scanner kb = new Scanner (System.in);
System.out.print("Please enter a word: ");
String oword = kb.nextLine();
String word = oword.toUpperCase();
int length = word.length();
int i = 0;
while (i < length)
{
System.out.println(word.substring(i,length));
length--;
}
}
}
Output:
Please enter a word: chess
CHESS
CHES
CHE
CH
C