AreWe

Untitled

May 2nd, 2018
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import java.util.Arrays;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5.  
  6. public static void main(String[] args) {
  7.  
  8. Scanner scanner = new Scanner(System.in);
  9.  
  10. char[] azbuka = {'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.  
  12. System.out.print("Enter word: ");
  13. String word = scanner.nextLine();
  14.  
  15. char[] charArray = word.toLowerCase().toCharArray();
  16.  
  17. int[] end = new int[charArray.length];
  18.  
  19. for(int i=0; i<end.length; i++){
  20. for(int j=0; j<azbuka.length; j++){
  21. if(charArray[i] == azbuka[j]){
  22. end[i] = j+1;
  23. break;
  24. }
  25. }
  26. }
  27.  
  28. System.out.println(Arrays.toString(end));
  29.  
  30. scanner.close();
  31. }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment