fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. string letter, word1;
  6. cout<<"Player 1: "<<endl;
  7. cin>> letter;
  8. cin>> word1;
  9. std::string s(word1);
  10.  
  11. if (s.find(letter) == 0){
  12. std::cout << "String starts with "<< letter<< endl;
  13. }
  14. return 0;
  15. }
Success #stdin #stdout 0s 4200KB
stdin
H Hello
stdout
Player 1: 
String starts with H