#include <iostream>
#include <algorithm>
inline bool yes_counter( char ch )
{
return ch == 'Y' || ch == 'y';
}
int main()
{
int const & counter = 10;
int yc = 0, nc = 0;
std::string votes {};
std::cout << "Enter a string of Yes and No votes: ";
std::getline( std::cin, votes );
votes.resize( counter ); //make sure input is exactly 10.
yc = std::count_if( votes.cbegin(), votes.cend(), yes_counter );
nc = std::count_if( votes.cbegin(), votes.cend(), []( char ch ) { return ch == 'N' || ch == 'n'; } );
std::cout << "Yes votes amount to " << yc << ", and No votes amount to " << nc << std::endl;
std::cout << "\tNumbers of Yes votes: " << std::string ( yc, '*' ) << std::endl;
std::cout << "\tNumbers of No votes: " << std::string ( nc, '*' ) << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgoKaW5saW5lIGJvb2wgeWVzX2NvdW50ZXIoIGNoYXIgY2ggKQp7CiAgICByZXR1cm4gY2ggPT0gJ1knIHx8IGNoID09ICd5JzsKfQoKaW50IG1haW4oKQp7CiAgICBpbnQgY29uc3QgJiBjb3VudGVyID0gMTA7CiAgICBpbnQgeWMgPSAwLCBuYyA9IDA7CiAgICBzdGQ6OnN0cmluZyB2b3RlcyB7fTsKCiAgICBzdGQ6OmNvdXQgPDwgIkVudGVyIGEgc3RyaW5nIG9mIFllcyBhbmQgTm8gdm90ZXM6ICI7CiAgICBzdGQ6OmdldGxpbmUoIHN0ZDo6Y2luLCB2b3RlcyApOwogICAgdm90ZXMucmVzaXplKCBjb3VudGVyICk7IC8vbWFrZSBzdXJlIGlucHV0IGlzIGV4YWN0bHkgMTAuCgogICAgeWMgPSBzdGQ6OmNvdW50X2lmKCB2b3Rlcy5jYmVnaW4oKSwgdm90ZXMuY2VuZCgpLCB5ZXNfY291bnRlciApOwogICAgbmMgPSBzdGQ6OmNvdW50X2lmKCB2b3Rlcy5jYmVnaW4oKSwgdm90ZXMuY2VuZCgpLCBbXSggY2hhciBjaCApIHsgcmV0dXJuIGNoID09ICd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