Logo
(追記) (追記ここまで)

31656번 - Sticky Keys 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB132378070562.060%

문제

Bob is texting Alice about his favourite programming problems, but he spilled coffee on his keyboard and now the keys get stuck when he types. The other day, he tried to tell her about the upcoming contest “UAPC”, but accidentally sent “UAAAAAPC” since his A key got stuck! Bob is an undergraduate so he can’t afford a new keyboard. He has asked you to write a program to correct his messages.

To make your life easier, Bob has agreed to avoid using messages with adjacent copies of the same letter (e.g., he won’t write about the “coffee” incident). So, you should always reduce duplicates down to a single character.

입력

The input consists of a string $S,ドル where 1ドル \le |S| \le 1000,ドル which is Bob’s entire message to Alice. There may be multiple space-separated words in the message, so the entire string $s$ including spaces should be considered part of the message.

The string $S$ is guaranteed to only include upper and lower-case characters, digits, and spaces. Thankfully, the coffee did not reach Bob’s spacebar so there will never be multiple spaces in a row.

출력

Output the message with repeated consecutive characters trimmed to a single character.

제한

예제 입력 1

UAAAAAPC

예제 출력 1

UAPC

예제 입력 2

UUAAPPCCC is my 11th faavvorite conNtEest

예제 출력 2

UAPC is my 1th favorite conNtEest

힌트

출처

University > University of Alberta Programming Contest > UAPC 2023 > Division 1 A번

University > University of Alberta Programming Contest > UAPC 2023 > Division 2 B번

  • 문제를 만든 사람: Noah Gergel
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /