Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. package java_stuff;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class myclass {
  6.  
  7. static void alphabet(String get_word)
  8. {
  9. char[] alphabet = new char[26];
  10. for (char i = 'a'; i <= 'z'; i++) {
  11. alphabet[i - 'a'] = i;
  12. }
  13. for(int i=0; i < get_word.length(); i++)
  14. {
  15. for(int j = 0; j< alphabet.length;j++)
  16. {
  17. if(get_word.charAt(i)==alphabet[j])
  18. System.out.print(j + " ");
  19. }
  20. }
  21.  
  22. //for(int i =0;i<alphabet.length;i++) //show array
  23. //System.out.print(alphabet[i] + " ");
  24. }
  25.  
  26. public static void main(String[] args) {
  27. alphabet("wew");
  28. }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement