Problem:
Score : 100 points

Problem Statement

On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in yyyy/mm/dd format. For example, January 23, 2018 should be written as 2018/01/23.

After finishing the document, she noticed that she had mistakenly wrote 2017 at the beginning of the date column. Write a program that, when the string that Takaki wrote in the date column, S, is given as input, modifies the first four characters in S to 2018 and prints it.

Constraints

S is a string of length 10.

The first eight characters in S are 2017/01/.

The last two characters in S are digits and represent an integer between 1 and 31 (inclusive).

Input

Input is given from Standard Input in the following format:

S

Output

Replace the first four characters in S with 2018 and print it.

Sample Input 1

2017/01/07

Sample Output 1

2018/01/07

Sample Input 2

2017/01/31

Sample Output 2

2018/01/31

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

#include <iostream>
#include <vector>

using namespace std;

const vector<int> values({10000, 5000, 1000});

int find(int N, int Y, int i, int ans[]){
  int tmp;
  if (i == 2){
    tmp = Y % 1000;
    if (N == tmp && Y == tmp*1000){
      ans[i] = tmp;
      return tmp;
    }
    else{
      ans[i] = -1;
      return -1;
    }
  }
  for (int j=0; j <= Y / values[i]; j++){
    if (i != 2){
      tmp = find(N - j, Y - j*values[i], i+1, ans);
      if (tmp != -1){
          ans[i] = j;
          return j;
      }
      else if (N < j || Y < j*values[i]) break;
    }
    
  }
  ans[i] = -1;
  return -1;
}

int main(){
  int N, Y;
  int d, r;
  vector<int> values({10000, 5000, 1000});
  int ans[3] = {-1, -1, -1};
  cin >> N >> Y;
  find(N, Y, 0, ans);
  
  cout << ans[0] << " " << ans[1] << " " << ans[2] << endl;
  
  return 0;
}