Ultraviolet-10340-All in All (string processing !)

Source: Internet
Author: User
Tags cmath

Ultraviolet-10340-All in All (string processing !)

Link: All in All



Problem E

All in All

Input:Standard input

Output:Standard output

Time Limit:2 seconds

Memory Limit:32 MB

You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. because of pending patent issues we will not discuss in detail how the strings are generated and inserted into the original message. to validate your method, however, it is necessary to write a program that checks if the message is really encoded in the final string.

Given two stringsSAndT, You have to decide whetherSIs a subsequenceT, I. e. if you can remove characters fromTSuch that the concatenation of the remaining characters isS.

Input Specification

The input contains several testcases. Each is specified by two stringsS, tOf alphanumeric ASCII characters separated by whitespace. Input is terminated by EOF.

Output Specification

For each test case output, ifSIs a subsequenceT.

Sample Input

sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter

Sample Output

Yes
No
Yes
No

Source: ULM Local Contest

          

Source

Root: Competitive Programming 3: The New Lower Bound of Programming Contests (Steven & Felix Halim): Problem Solving Paradigms: Greedy: Non Classical, Usually Harder
Root: aoapc ii: Beginning Algorithm Contests (Second Edition) (Rujia Liu): Chapter 3. Arrays and Strings: Exercises
Root: aoapc I: Beginning Algorithm Contests -- Training Guide (Rujia Liu): Chapter 1. Algorithm Design: General Problem Solving Techniques: Exercises: Beginner
Root: aoapc I: Beginning Algorithm Contests (Rujia Liu): Volume 4. Algorithm Design
Root: Competitive Programming 2: This increases the lower bound of Programming Contests. Again (Steven & Felix Halim): Problem Solving Paradigms: Greedy-Standard

Root: Competitive Programming: Increasing the Lower Bound of Programming Contests (Steven & Felix Halim): Chapter 3. Problem Solving Paradigms: Greedy



Simple string processing, not to mention, directly on the Code (RE many times, cry ..) :


/*************************************** * *********************************> File Name: a. cpp> Author: zzuspy> Mail: zzuspy@qq.com> Created Time: monday 1, December 01, 2014 ******************************** **************************************** /# include
 
  
# Include
  
   
# Include
   
    
# Include
    
     
# Include
     
      
# Include
      
        # Include
       
         # Define LL long # define max3 (a, B, c) max (a, max (B, c) # define min3 (a, B, c) min (, min (B, c) using namespace std; char a [100005], B [100005]; // The question is not too big. I used to open only 10005, RE to death !!!! Int main () {while (scanf ("% s", a, B )! = EOF) {int I, j, lena = strlen (a), lenb = strlen (B); if (lena> lenb) {printf ("No \ n "); continue;} for (I = 0, j = 0; B [j]! = '\ 0' & I
        
          Lenb-j) break; if (a [I] = B [j]) I ++;} if (I = lena) printf ("Yes \ n "); else printf ("No \ 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.