Let’s Portmanteau

시간 제한5초메모리 제한1024 MB

요약
첫 단어의 두 번째 글자부터 오른쪽으로 가며 모음 전까지, 둘째 단어의 끝에서 왼쪽으로 가며 모음 전까지 취해 하나의 모음으로 이어 붙인다.
난이도

쉬움10점 중 3점

유형
문자열, 구현
정답자
아직 제출이 없습니다

문제

From “yourdictionary.com”: Portmanteau, pronounced “port-man-tow,” refers to a new word made from two words and their meanings. For example, the portmanteau brunch refers to a combined meal of breakfast and lunch, and spork is a mix between a spoon and a fork.

You are to combine two words using a simplified approach.

Rules for combining:

  1. Get the first letter of the first word regardless of what (vowel or consonant) it is. Then, starting from the second letter of the first word, get letters moving right until you reach a vowel. If no vowels while moving right, all letters will be taken. If there is a vowel moving right, let’s call it v1.

  2. Get the last letter of the second word regardless of what (vowel or consonant) it is. Then, starting from the letter next to the last letter of the second word, get letters moving left until you reach a vowel. If no vowels while moving left, all letters will be taken. If there is a vowel moving left, let’s call it v2.

  3. Combine the two words by listing the letters taken from the first word (Step 1), followed by a vowel (let’s call it the merging vowel), followed by the letters taken from the second word (Step 2). The merging vowel is as follows:

    1. If the second word has a vowel while moving left (i.e., v2 exists), v2 is the merging vowel.
    2. If the second word does not have a vowel while moving left (i.e., v2 does not exist) but the first word has a vowel while moving right (i.e., v1 exists), v1 is the merging vowel.
    3. If v1 and v2 don’t exist (i.e., neither word has a vowel while moving right/left), use the letter “o” as the merging vowel.

Assume the vowels are “aeiou”.

입력

There are two input lines: the first line provides the first word and the second line provides the second word. Assume that each word starts in column 1, is at least 4 letters and at most 20 letters, and contains only lowercase letters.

출력

Print the combined word on one output line.

예제3

  1. 예제 1

    입력
    abcdefun
    ghijku
    
    예상 출력
    abcdijku
    
  2. 예제 2

    입력
    abcdefun
    ghmn
    
    예상 출력
    abcdeghmn
    
  3. 예제 3

    입력
    abycd
    fgyhu
    
    예상 출력
    abycdofgyhu