Advertisement
16225

2.3

Jun 16th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. package KursovaRabotaSrok2;
  2. import java.util.Scanner;
  3. public class IndexOfLetter3 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         String input = scanner.nextLine().toLowerCase();
  7.         char[] letters = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
  8.         for (int i = 0; i < input.length(); i++) {
  9.             char symbol = input.charAt(i);
  10.             int position = new String(letters).indexOf(symbol);
  11.             System.out.printf("%c -> %d%n", symbol, position);
  12.         }
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement