/*************************************************************************
> File Name: ex10.2.cpp
> Author:
> Mail:
> Created Time: Thu 29 Feb 2024 11:49:46 AM CST
************************************************************************/
#include
#include
#include
#include
#include
using namespace std;
int main(){
list<string> lst;
string str;
cout<<"Enter strings: ";
while(cin>>str){
lst.push_back(str);
if(cin.get() == '\n'){
break;
}
}
string val;
cout<<"Enter value: ";
cin>>val;
int result;
result = count(lst.begin(), lst.end(), val);
if(result == 0){
cout<<"The value is not in strings."<<endl;
}
else{
cout<<"The value appears "<<result<<" times in strings."<<endl;
}
return 0;
}