Guest User

Untitled

a guest
May 24th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <string.h>
  4. using namespace std;
  5.  
  6. int main() {
  7. int i, alen, slen;
  8. int a[26];
  9. memset(a, -1, 26 * sizeof(int));
  10. string s;
  11. cin >> s;
  12. slen = s.size();
  13. for (i = 0; i < slen; i++) {
  14. if (a[s[i] - 'a'] == -1) {
  15. a[s[i] - 'a'] = i;
  16. }
  17. }
  18. for (i = 0; i < 26; i++) {
  19. cout << a[i] << " ";
  20. }
  21. cout << '\n';
  22. }
Add Comment
Please, Sign In to add comment