fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. string s, mau="hello";
  4. int i, j=0;
  5. int main(){
  6. ios_base::sync_with_stdio(false);
  7. cin.tie(0); cout.tie(0);
  8. cin >> s;
  9. for (i=0; s[i]; i++){
  10. if (s[i]==mau[j]){
  11. cout << s[i] << " " << i << " " << j << endl;
  12. j++;
  13. if (j==5) break;
  14. }
  15. }
  16. if (j==5) cout << "YES";
  17. else cout << "NO";
  18. return 0;
  19. }
Success #stdin #stdout 0s 5320KB
stdin
xqjqmenkodmlhzyzmmvofdngktygbbxbzpluzcohohmalkoeuwfikblltaaigv
stdout
h 12 0
e 47 1
l 54 2
l 55 3
NO