#include <iostream>
#include <string>
int main( )
{
{
const std:: string str = "Random irrelevent text here $500.22+$200.33 More random $irrelevent text$" ;
std:: cout << str << "\n character '$' found at positions: " ;
std:: string :: size_type pos = str.find ( '$' ) ;
while ( pos ! = std:: string :: npos )
{
std:: cout << pos << ' ' ;
pos = str.find ( '$' , pos+ 1 ) ;
}
}
{
const std:: string str = "\n \n Random text here 50-people more random text" ;
std:: cout << str << "\n substring '50-people' found starting at position: "
<< str.find ( "50-people" ) << '\n ' ;
if ( str.find ( '$' ) == std:: string :: npos ) std:: cout << " character '$' was not found\n " ;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgoKaW50IG1haW4oKQp7CiAgICB7CiAgICAgICAgY29uc3Qgc3RkOjpzdHJpbmcgc3RyID0gIlJhbmRvbSBpcnJlbGV2ZW50IHRleHQgaGVyZSAkNTAwLjIyKyQyMDAuMzMgTW9yZSByYW5kb20gJGlycmVsZXZlbnQgdGV4dCQiIDsKICAgICAgICBzdGQ6OmNvdXQgPDwgc3RyIDw8ICJcbiAgICBjaGFyYWN0ZXIgJyQnIGZvdW5kIGF0IHBvc2l0aW9uczogIiA7CiAgICAgICAgc3RkOjpzdHJpbmc6OnNpemVfdHlwZSBwb3MgPSBzdHIuZmluZCggJyQnICkgOwogICAgICAgIHdoaWxlKCBwb3MgIT0gc3RkOjpzdHJpbmc6Om5wb3MgKQogICAgICAgIHsKICAgICAgICAgICAgc3RkOjpjb3V0IDw8IHBvcyA8PCAnICcgOwogICAgICAgICAgICBwb3MgPSBzdHIuZmluZCggJyQnLCBwb3MrMSApIDsKICAgICAgICB9CiAgICB9CgogICAgewogICAgICAgIGNvbnN0IHN0ZDo6c3RyaW5nIHN0ciA9ICJcblxuUmFuZG9tIHRleHQgaGVyZSA1MC1wZW9wbGUgbW9yZSByYW5kb20gdGV4dCIgOwogICAgICAgIHN0ZDo6Y291dCA8PCBzdHIgPDwgIlxuICAgIHN1YnN0cmluZyAnNTAtcGVvcGxlJyBmb3VuZCBzdGFydGluZyBhdCBwb3NpdGlvbjogIgogICAgICAgICAgICAgICAgICA8PCBzdHIuZmluZCggIjUwLXBlb3BsZSIgKSA8PCAnXG4nIDsKICAgICAgICBpZiggc3RyLmZpbmQoICckJyApID09IHN0ZDo6c3RyaW5nOjpucG9zICkgc3RkOjpjb3V0IDw8ICIgICAgY2hhcmFjdGVyICckJyB3YXMgbm90IGZvdW5kXG4iIDsKICAgIH0KfQo=