-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathER21A.java
45 lines (30 loc) · 807 Bytes
/
ER21A.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
*In the name of Allah the Most Merciful.
* Author
* Md. Toufiqul Islam
* Dept. Of CSE
* Ahsanullah University Of Science And Technology
*/
package CodeForces;
import java.util.Scanner;
public class ER21A {
public static void main(String[] arg){
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
if(s.length()>1){
int len = s.length();
String firstCh= Character.toString(s.charAt(0));
String first = Integer.toString(Integer.parseInt(firstCh)+1);
for(int i=0;i<len-1;i++){
first+="0";
}
int res = Integer.parseInt(first)-Integer.parseInt(s);
System.out.println(res);
}
else if(s.length()==1){
int next = Integer.parseInt(s)+1;
int res =next-Integer.parseInt(s);
System.out.println(res);
}
}
}