fork download
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. char name[101]={'\0'};
  6.  
  7. gets(name);
  8. int i, j;
  9.  
  10. for (int i = 0; i<26; i++)
  11. {
  12. for (j = 0; j < 100; j++)
  13. {
  14. if ((int)name[j] == 97 + i)
  15. {
  16. printf("%d ", j);
  17. break;
  18. }
  19. else
  20. if (j == 25&&name[j]!='\0')
  21. {
  22. printf("-1 ");
  23. break;
  24. }
  25.  
  26. }
  27. }
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0s 4504KB
stdin
baekjoon
stdout
1 0 2 4 3 7 5