Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package java_stuff;
- import java.util.Scanner;
- public class myclass {
- static void alphabet(String get_word)
- {
- char[] alphabet = new char[26];
- for (char i = 'a'; i <= 'z'; i++) {
- alphabet[i - 'a'] = i;
- }
- for(int i=0; i < get_word.length(); i++)
- {
- for(int j = 0; j< alphabet.length;j++)
- {
- if(get_word.charAt(i)==alphabet[j])
- System.out.print(j + " ");
- }
- }
- //for(int i =0;i<alphabet.length;i++) //show array
- //System.out.print(alphabet[i] + " ");
- }
- public static void main(String[] args) {
- alphabet("wew");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement