fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. int num;
  4. int main() {
  5. int i, j;
  6. int cnt = 0;
  7. char arr[100] = { 0 };
  8. scanf("%s", arr);
  9. for (i = 'a'; i <= 'z'; i++) {
  10. for (j = 0; j < 100; j++) {
  11. if (arr[j] == i) {
  12. arr[j] = j;
  13. num = j;
  14. break;
  15. }
  16. else cnt++;
  17.  
  18. }
  19. if (cnt == 100) printf("-1 ");
  20. else printf("%d ",arr[num]);
  21. num = 0;
  22. cnt = 0;
  23. }
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 5460KB
stdin
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccca
stdout
98 98 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1