Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. package test;
  2.  
  3. public class test {
  4.  
  5. public static void main (String[] args) {
  6. String alphabet = "abcdefghijklmnopqrstuvwxyz";
  7. String key = "swiftly";
  8.  
  9. keysolver(key);
  10.  
  11. }
  12. public static int keysolver(String s) {
  13.  
  14. String temp = s;
  15. int i;
  16.  
  17. if(temp.length()>0) {
  18. for(i=0;i<temp.length();i++) {
  19.  
  20. char letter = temp.charAt(i);
  21. int distance = letter-'a';
  22.  
  23. return distance;
  24.  
  25. }
  26.  
  27. }
  28. else {
  29. return 0;
  30. }
  31. }
  32.  
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement