Problem:
Score : 100 points

Problem Statement

There is an N-car train.

You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Constraints

1 \leq N \leq 100

1 \leq i \leq N

Input

Input is given from Standard Input in the following format:

N i

Output

Print the answer.

Sample Input 1

4 2

Sample Output 1

3

The second car from the front of a 4-car train is the third car from the back.

Sample Input 2

1 1

Sample Output 2

1

Sample Input 3

15 11

Sample Output 3

5

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

#include <bits/stdc++.h>
using namespace std;

int main() {
  int H, W;//Hは縦、Wは横
  cin >> H >> W;
  vector<vector<char>> table(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++){ 
    cin >> table.at(i).at(j);
  }
  }//入力完了
  int Hcounter = 0;
  for (int i = 0; i < H; i++){
  for (int j = 0; j < W; j++){
  if (table.at(i).at(j) != '.')
    break;
  if (j == W - 1)
    Hcounter++;//削る行の数把握
  }
  }
  int newH = H - Hcounter;
  vector<vector<char>> Ftable(newH, vector<char>(W));//行削る用の表配列
  int l = 0;
  for (int i = 0; i < H; i++){
  for (int j = 0; j < W; j++){
  if (table.at(i).at(j) != '.'){
        for (int k = 0; k < W; k++)
      Ftable.at(l).at(k) = table.at(i).at(k);
    l++;
    break;
  }
  }
  }//行削り完了
      
  int Wcounter = 0;
  for (int j = 0; j < W; j++){
  for (int i = 0; i < newH; i++){
  if (table.at(i).at(j) != '!')
    break;
  if (i == newH - 1)
    Wcounter++;//削る列の数把握
  }
  }
  
  int newW = H - Hcounter;
  vector<vector<char>> Stable(newH, vector<char>(newW));//列削る用の表配列
  int n = 0;
  for (int j = 0; j < W; j++){
  for (int i = 0; i < newH; i++){
  if (Ftable.at(i).at(j) != '.'){
        for (int k = 0; k < newH; k++)
      Stable.at(k).at(n) = Ftable.at(k).at(j);
    n++;
    break;
  }
  }
  }//列削り完了
   for (int i = 0; i < newH; i++) {
   for (int j = 0; j < newW; j++){ 
     if (j == newW - 1)
    cout << Stable.at(i).at(j) << endl;
     else
       cout << Stable.at(i).at(j);
  }
  }//出力完了
}