A - Spoiler Editorial by en_translator
For beginners
- If you are new to learning programming and do not know where to start, please try Problem A "Welcome to AtCoder" from practice contest.  There you can find a sample code for each language.  
 
- Also, if you are not familiar with problems in programming contests, we recommend you to try some problems in "AtCoder Beginners Selection".  
 
- 「C++入門 AtCoder Programming Guide for beginners (APG4b)」 is a C++ tutorial for competitive programmers.  Sadly, this is only in Japanese too.
 
Many solutions are available for this problem.
Solution 1
Split \(S\) into three parts by |, and the answer is the concatenation of the first and third.  For example, one can use split method in Python.
Sample code (Python)
S = input()
a, b, c = S.split('|')
print(a+c)
Solution 2
Let \(x\) and \(y\) be the positions of the two occurrences of | in \(S\), then the sought string is the concatenation of the substring prior to the \(x\)-th character and another succeeding the \(y\)-th character.  For example, one can use find and substr methods in C++.
Sample code (C++)
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin >> s;
	int x = s.find("|");  // The first occurrence of `|` when scanning from the head
	int y = s.rfind("|");  // The first occurrence of `|` when scanning from the tail
	cout << s.substr(0,x) + s.substr(y+1) << endl;
}
Solution 3
Prepare an empty string \(T\).  Iterate through the characters of \(S\) from the beginning.  Ignore the characters between the first and second occurrences of |, and append the other inspected characters to \(T\).  This way, the sought string can be obtained.  For example, one can implement it in C++ as follows:
Sample code (C++)
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin >> s;
	string t;
	int count = 0;
	for(char c: s){
		if(c= = '|'){
			count++;
		}else{
			if(count != 1) t+=c;
		}
	}
	cout << t << endl;
}
Solution 4
One can use regular expression to obtain the sought string.  Note that | must be escaped.  For example, one can use re.sub method in Python.
Sample code (Python)
import re
S = input()
print(re.sub("\|.*\|", "", S))
				posted:
				
				
				last update: