#51. 字符串偶数次出现统计

    ID: 51 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatMap-2gesp5字符串STL

字符串偶数次出现统计

Append on Even Occurrences

Background

Congcong is facing a string processing challenge. He needs to extract strings with a specific pattern from an array of strings.

Problem Description

Loop over the given array of strings to build a result string. When a string appears the 2nd2^{nd}, 4th4^{th}, 6th6^{th}, etc. time in the array, append the string to the result. Return the empty string if no string appears a 2nd2^{nd} time.

Input Format

The input is given from standard input in the following format.

The input consists of a single line, representing an array of strings. Strings in the array are separated by spaces and enclosed in double quotes.

Output Format

Output to standard output in the following format.

Output a single string, which is the result string built according to the rules.

Sample

"a" "b" "a"
"a"
"a" "b" "a" "c" "a" "d" "a"
"aa"
"a" "" "a"
"a"

Sample Explanation

Sample 1 Explanation: The string "a" appears for the 1st time, not appended. The string "b" appears for the 1st time, not appended. The string "a" appears for the 2nd time, append "a" to the result. The final result is "a".

Sample 2 Explanation: The string "a" appears for the 1st time, not appended. The string "b" appears for the 1st time, not appended. The string "a" appears for the 2nd time, append "a" to the result. The string "c" appears for the 1st time, not appended. The string "a" appears for the 3rd time, not appended. The string "d" appears for the 1st time, not appended. The string "a" appears for the 4th time, append "a" to the result. The final result is "aa".

Sample 3 Explanation: The string "a" appears for the 1st time, not appended. The empty string "" appears for the 1st time, not appended. The string "a" appears for the 2nd time, append "a" to the result. The final result is "a".

Constraints

Time limit: 11 second, Memory limit: 10241024 KiB for each test case.