fork(2) download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int ChartoHex(char c)
  5. {
  6. int hex;
  7.  
  8. if(c>='A'&&c<='Z')
  9. hex=c-'A';
  10. else if(c>='a'&&c<='z')
  11. hex=c-'a';
  12.  
  13. return hex;
  14. }
  15.  
  16. int main(void)
  17. {
  18. char a[101] = {0};
  19. int length,position;
  20. int abc[26]={-1};
  21.  
  22. scanf("%s",a);
  23. length = strlen(a);
  24.  
  25. for(int j=0;j<length;j++)
  26. {
  27. position = ChartoHex(a[j]);// Ascii to Hex A
  28. if(abc[position]==-1)
  29. abc[position]=j;
  30. }
  31. for(int i=0;i<26;i++)
  32. printf("%d ",abc[i]);
  33. }
Success #stdin #stdout 0.01s 5280KB
stdin
baekjoon
stdout
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0