Advertisement
16225

2,3 Ралица

Jun 16th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1.  
  2. package Kursovaa2;
  3. import java.util.Scanner;
  4. public class IndexOfLetter3 {
  5.     public static void main(String[] args) {
  6.  
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         String input = scanner.nextLine().toLowerCase();
  10.         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'};
  11.         for (int i = 0; i < input.length(); i++) {
  12.             char symbol = input.charAt(i);
  13.             int position = new String(letters).indexOf(symbol);
  14.             System.out.printf("%c -> %d%n", symbol, position);
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement