Skip to content

Instantly share code, notes, and snippets.

@vitorizkiimanda
Created March 20, 2018 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vitorizkiimanda/cb29cb3fdb81402622a668963dd09fa9 to your computer and use it in GitHub Desktop.
Save vitorizkiimanda/cb29cb3fdb81402622a668963dd09fa9 to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,result=0;
string temp, quest;
vector<string> names;
cout << "How many names?"<<endl;
cin >> n;
cout << "input those names :"<<endl;
for(int i = 0; i<n ;i++){
cin >> temp;
names.push_back(temp);
}
cout << "Find : "<<endl;
cin >> quest;
for(int i = 0; i<names.size();i++){
if(quest == names[i].substr(0,quest.length())) result++;
}
cout << result << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment