fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <iterator>
  4. #include <algorithm>
  5. #include <cctype>
  6. #include <type_traits>
  7. using namespace std;
  8.  
  9. int main() {
  10. auto translate = [](char c) -> int{
  11. auto check = string("wqka");
  12. auto pos = check.find(c);
  13. return pos != string::npos?
  14. pos+11 : c;
  15. };
  16.  
  17. char source[] = "wQkacostenteges";
  18. int result[extent<decltype(source)>::value-1] = {0};
  19.  
  20. transform(
  21. begin(source),
  22. end(source)-1,
  23. begin(result),
  24. [&](char c){ return translate(tolower(c)); }
  25. );
  26.  
  27. for(int x: result){
  28. cout << x << " ";
  29. }
  30. return 0;
  31. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
11 12 13 14 99 111 115 116 101 110 116 101 103 101 115