Programming contests

ACM ICPC programozó csapatverseny, házi forduló, 2017. október 29.

October 29, 2017, 10:00 AM – October 29, 2017, 3:00 PM

X X Glued

Do you know the game “X X glued” practiced on the registration plates of Benin cars by children?

A Beninese car registration number is written in the form VY ABCD RB or Y ABCD RB. For example, AC 2554 RB and X 6006 RB are Beninese car registration numbers. The game “X X glued” is to quickly verify whether there are two identical consecutive digits in the number or not. The winner is the first child that pronounces “X X collés” (Benin is a French-speaking nation) and shows the car with his finger.

Input Specification

The input contains several lines and ends with the # character on a single line. Each of the other lines contains a single registration number as VY ABCD RB or Y ABCD RB, where V and Y are uppercase English letters, A, B, C, and D are decimal digits.

Output Specification

For each registration number, your program should display in a single line all the “X X glued” in the format shown in the example. Note that if there is more than one pair of identical digits, they should be printed in the same order as they appear in the registration number. If the same pair of identical digits appears multiple times, only the first occurrence should be printed. If there is no “X X glued” in the number, the program should display nothing (not even a blank line).

Sample Input

  1. X 6006 RB
  2. AC 2233 RB
  3. T 2000 RB
  4. F 2345 RB
  5. AB 4444 RB
  6. #
download as text file

Output for Sample Input

  1. 0 0 glued
  2. 2 2 glued and 3 3 glued
  3. 0 0 glued
  4. 4 4 glued
download as text file
University of Debrecen; Faculty of Informatics; v. 09/30/2024