Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.BufferedWriter;
  3. import java.io.IOException;
  4. import java.io.InputStreamReader;
  5. import java.io.OutputStreamWriter;
  6.  
  7. public class Main{
  8. public static void main(String args[]) throws IOException{
  9. BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  10. BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
  11.  
  12. String come = br.readLine();
  13. int[] alp = new int[26];
  14.  
  15. for(int i=0;i<26;i++)alp[i] = -1;
  16.  
  17. for(int i=0;i<come.length();i++){
  18. int val = come.charAt(i)-'a';
  19. if(alp[val]==-1) alp[val] = i;
  20. }
  21.  
  22. for(int i=0;i<26;i++) bw.write(alp[i]+" ");
  23.  
  24. bw.flush();
  25. bw.close();
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement