fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. int main()
  4. {
  5. char str[100];
  6. scanf("%s", str);
  7. int len = strlen(str);
  8. int first = -1, count = 0;
  9. for (int i = 0; i < len; i++)
  10. {
  11. if (str[i] == 'k')
  12. {
  13. if (count == 0) {
  14. first = i;
  15. }
  16. count++;
  17. printf("%d ", i);
  18. }
  19. }
  20. if (first == -1) {
  21. printf("Not found!");
  22. }
  23. return 0;
  24. }
Success #stdin #stdout 0s 5280KB
stdin
454
stdout
Not found!