Created
March 20, 2018 03:49
-
-
Save vitorizkiimanda/cb29cb3fdb81402622a668963dd09fa9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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