fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int n;
  4. string s;
  5. vector<int> v;
  6. int main(){
  7. cin >> n;
  8. for(int i = 0; i < n; i++){
  9. cin >> s;
  10. string ret = "";
  11. for(int j = 0; j < s.size(); j++){
  12. if(s[j] < 97 || s[j] > 122) ret += s[j];
  13. else {
  14. if(ret.size()){
  15. v.push_back(atoi(ret.c_str()));
  16. ret = "";
  17. }
  18. }
  19. }
  20. if(ret.size()){
  21. v.push_back(atoi(ret.c_str()));
  22. }
  23. }
  24. sort(v.begin(), v.end());
  25. for(int a : v) cout << a << '\n';
  26. }
Success #stdin #stdout 0s 5320KB
stdin
4
01bond
02james007
03bond
04austinpowers000
stdout
0
1
2
3
4
7