Advertisement
Dido09

2.3 - LettersToIndex

May 8th, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class LettersToIndex {
  4.  
  5. public static void main(String[] args) {
  6. String[] alphabet = new String[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o",
  7. "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
  8. Scanner scanner = new Scanner(System.in);
  9. String line = scanner.nextLine().toLowerCase();
  10. String lineArgs[] = line.split("");
  11. for (int i = 0; i < lineArgs.length; i++) {
  12. System.out.println(lineArgs[i] + " -> " + Arrays.asList(alphabet).indexOf(lineArgs[i]));
  13. }
  14. }
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement