Uva10815 use of the set container StringStream SS

Source: Internet
Author: User
Topic Connection: http://acm.hust.edu.cn/vjudge/problem/18649 Sample Input

Adventures in Disneyland
Blondes were going to Disneyland, they came to a fork in the
Road.
The sign read: "Disneyland left." So they went home. Sample Output

A
Adventures
Blondes
Came
Disneyland
Fork
Going
Home
Inch
Left
Read
Road
Sign
So
The
They
To
Both
Went
Were
When test instructions

is to follow the dictionary order to output each word, regardless of the case, all converted to lowercase output. Solving

The place of a slight pit, for example: "Ffw.sef", this is counted as two words ffw and SEF. StringStream SS Stream Processing method (new posture) See Code StringStream SS (s), you can process the string s separately into each word Code

 #include <bits/stdc++.h> using namespace std; void tr (string &st) {String::iterator
    A
        For (A=st.begin (); A!=st.end (); a++) {if (*a>= ' a ' &&*a<= ' Z ') *a=*a+32;
        else if (*a>= ' a ' &&*a<= ' z ') *a=*a;
    else {*a= ';}
    }} int main () {set<string> s;
    String Zz,buf;
        while (CIN>>ZZ) {tr (ZZ);
        StringStream SS (ZZ);
    while (SS>>BUF) S.insert (BUF);
    } Set<string>::iterator it;
    For (It=s.begin (); It!=s.end (); it++) {cout<<*it<< "\ n";
} return 0; }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.