Problem:
Score : 100 points

Problem Statement

Snuke is going to open a contest named "AtCoder s Contest".
Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters.

Snuke has decided to abbreviate the name of the contest as "AxC".
Here, x is the uppercase English letter at the beginning of s.

Given the name of the contest, print the abbreviation of the name.

Constraints

The length of s is between 1 and 100, inclusive.

The first character in s is an uppercase English letter.

The second and subsequent characters in s are lowercase English letters.

Input

The input is given from Standard Input in the following format:

AtCoder s Contest

Output

Print the abbreviation of the name of the contest.

Sample Input 1

AtCoder Beginner Contest

Sample Output 1

ABC

The contest in which you are participating now.

Sample Input 2

AtCoder Snuke Contest

Sample Output 2

ASC

This contest does not actually exist.

Sample Input 3

AtCoder X Contest

Sample Output 3

AXC

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <bits/stdc++.h>

using namespace std;

int main() {
	long long A[100005];
	long long n, x;
	scanf("%lld %lld", &n, &x);
	long long ans = 0;
	for (int i = 0; i < n; ++i) {
		long long  aux;
		scanf("%lld", &aux);
		if (aux > x) {
			ans += (aux - x);
		}
		A[i] = min(aux, x);
		if (i > 0) {
			if (A[i] + A[i - 1] > x) {
				ans += A[i] + A[i - 1] - x;
				A[i] -= x;
				if (A[i] < 0) {
					A[i - 1] += A[i];
					A[i] = 0;
				}
			}
		}
	}
	cout << ans;
}