Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package _8_07_JAN;
- import java.util.Scanner;
- public class _2_TerroristsWin {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- String[] line = input.nextLine().split("");
- int sum = 0;
- int first = 0;
- int second = 0;
- int bomb = 0;
- for (int i = 0; i < line.length; i++) {
- if (line[i].equals("|")) {
- first = i;
- sum =0;
- for (int j = i+1; j < line.length; j++) {
- if (!line[j].equals("|")) {
- sum = sum + line[j].charAt(0);
- bomb = sum%10;
- }
- else {
- second = j;
- break;
- }
- }
- for (int k = first - 1; k > first-bomb-1; k--) {
- line[k]=".";
- }
- for (int k = first ; k <= second; k++) {
- line[k]=".";
- }
- for (int k = second + 1; k < second+bomb+1; k++) {
- line[k]=".";
- }
- }
- }
- for (int j2 = 0; j2 < line.length; j2++) {
- System.out.print(line[j2]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement