import java.util.Scanner; public class Bottles { public static void main(String args[]) { Scanner in = new Scanner(System.in); int bottles = Integer.parseInt(in.nextLine()); String beverage = in.nextLine(); for (int num = bottles; num >= 1; num--) { String bottleText = "bottles"; if (num == 1) { bottleText = "bottle"; } System.out.printf("%d %s of %s on the wall, %d %s of %s.\n", num, bottleText, beverage, num, bottleText, beverage); if (num - 1 == 1) { bottleText = "bottle"; } else { bottleText = "bottles"; } System.out.printf("Take one down and pass it around, %d %s of %s on the wall.\n", num - 1, bottleText, beverage); } System.out.printf("0 bottles of %s on the wall, 0 bottles of %s.\n", beverage, beverage); System.out.printf("Go to the store and buy some more, %d bottles of %s on the wall.\n", bottles, beverage); } }