URAL 1545. Hieroglyphs

Source: Internet
Author: User

1545. Hieroglyphs
Time limit:1.0 Second
Memory limit:64 MB
Vova is fond of anime. He is so enthusiastic on this art, he learned to communicate with his Japanese friends using their native language. However, for writing email messages Vova have to use Latin letters. He wants to type hieroglyphs from the his keyboard. His team-mate-Sergey, in order-to-help Vova, created a applet that makes it possible-write hieroglyphs by means of Typ ing Latin letters on the keyboard. Each hieroglyph are represented by a sequence of both Latin letters. This correspondence was given in a special reference book compiled by Sergey. When the applets realizes that a sequence of Latin letters corresponding to a hieroglyph have been typed, it replaces the SE Quence with this hieroglyph. When Vova started using Sergey's program, he quickly became bored of looking to the reference book so often. Help Sergey to upgrade the applet in such a-in-a-typed Latin letter it would automatically supply a prompt he Lping to continue a sequence RepresentinG A hieroglyph. Inputthe First line contains the number of hieroglyphs in Sergey ' s reference book  N(1≤ N≤1000). Each of the next NLines contains a sequence of the lowercase Latin letters corresponding to a hieroglyph. The next line contains a lowercase Latin letter entered by Vova.outputoutput sequences from the reference book that start With the given letter, one sequence per line, and an arbitrary order. If There is no such sequences, then output nothing. Sample
input Output
6nanonikikakuk
Kakiku




Test instructions: Outputs a string of n strings that begin with the given letter. The order is unlimited.

Parse: Traverse once.



AC Code:

#include <cstdio> #include <iostream> #include <string>using namespace std;string s[1002];int main () {    #ifdef sxk        freopen ("In.txt", "R", stdin);    #endif//sxk    int n;    char c;    while (scanf ("%d", &n) ==1) {for        (int i=0; i<n; i++) cin>>s[i];        cin>>c;        for (int i=0; i<n; i++)            if (s[i][0] = = c) cout<<s[i]<<endl;    }    return 0;}




URAL 1545. Hieroglyphs

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.