fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. string str, res="";
  9. cin>>str;
  10.  
  11. res+=str[0];
  12. for(int i=0; i<str.length(); i++){
  13. if(str[i]=='-'){
  14. res+=str[i+1];
  15. }
  16. }
  17.  
  18. cout<<res;
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5280KB
stdin
Knuth-Morris-Pratt
stdout
KMP