Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class IndexOfLetters {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- char[] alphabet = new char[26];
- for (int i = 0; i < 26; i++) {
- alphabet[i] = (char)('a' + i);
- }
- String word = scanner.nextLine().toLowerCase();
- for (int i = 0; i < word.length(); i++) {
- for (int j = 0; j < alphabet.length; j++) {
- if (word.charAt(i) == alphabet[j]) {
- System.out.println(word.charAt(i) + " -> " + j);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement