fork download
  1. #include<iostream>
  2. using namespace std;
  3. int main(void) {
  4. char input[101];
  5. scanf("%s", &input);
  6. int index = 0;
  7. int alpha[26];
  8. while (true)
  9. {
  10. if (input[index] == 0)
  11. break;
  12. /*printf("%c\n", input[index]);
  13. */
  14. if (alpha[input[index] - 97] < 0)
  15. {
  16. alpha[input[index] - 97] = index;
  17. }
  18.  
  19.  
  20. index++;
  21. }
  22.  
  23. for (int i = 0; i < 25; i++) {
  24. if (alpha[i] < 0)
  25. {
  26. printf("-1 ");
  27. }
  28. else {
  29. printf("%d ", alpha[i]);
  30. }
  31.  
  32. }
  33. if (alpha[25] < 0)
  34. {
  35. printf("-1\n");
  36. }
  37. else {
  38. printf("%d\n", alpha[25]);
  39. }
  40.  
  41. return 0;
  42. }
  43. //모두 소문자로 이루어 져있다.
  44. //
Success #stdin #stdout 0s 15232KB
stdin
baekjoon
stdout
183255112 22097 183255121 22097 994325312 11082 994325312 11082 183255112 22097 1005136841 11082 1 0 2 0 183254408 22097 181156365 22097 142 0 0 0 181156288 22097