EIUQBHV - Possible passwords
Xem dạng PDF
Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
256M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
Duy is a professional gamer of League of Legends. Bcause he often forgets his game password, Duy wrote it down on a piece of paper.
One unlucky day, the pet dog Warwick accidentally bit the paper. After picking up all the pieces of paper, Duy wasn't sure what the order was for his password, but Duy was sure all the characters were there.
Currently Duy really needs to enter the game to practice for the upcoming world final, so he intends to ask a friend to help him list all the cases. Duy will try to log in until he succeeds and Duy promises to give an ultimate outfit to anyone who can help Duy.
Input
- A string with ~N~ capital letters (~1 \leq N \leq 9~)
Output
- The first line is ~M~, the number of possible passwords.
- The next ~M~ lines are instances of the password sorted lexicographically.
Note
- Pseudocode for this problem in Text Book page ~172~ (Introduction to the Design & Analysis of Algorithms)
- Link: https://drive.google.com/file/d/16iWBgVoOVp1rFhriVjwL4cNH3AyVEZ6/view?usp=drivelink
Example Input 1
ABC
Example Output 1
6
ABC
ACB
BAC
BCA
CAB
CBA
Bình luận