Another String


Submit solution

Points: 5
Time limit: 3.0s
Memory limit: 250M

Author:
Problem type

We have a string \(X\), we want to find another string \(Y\) that has the same meaning of string \(X\).

Two strings have the same meaning if and only if they have the same length and all the characters of the english alphabet (case sensitive) have the same number of occurrences in both strings.

Input Specification

The first line will contain the number of test cases \(T\).

Each test case will consist of one line containing a single alphabetic string
\(X\) (\(1 \leq |X| \leq 100\))
the string for which you need to find one with the same meaning.

Output Specification

For each test case, output, in a single line, a string \(Y\) that has the same meaning of the input string.

If there are multiple strings with the same meaning, print any one of them.

Sample Input

4
uBiPhTqY
afmEuh
SuoUM
XcxtWIeoE

Sample Output

hBqiuTYP
umafEh
oMSuU
EWeIctoxX

Comments


  • 0
    AkramElOmrani  commented on Sept. 1, 2021, 8:50 p.m. edited

    I just wanna ask why is their such time constraints I mean 3s!! a O(n!) would pass for n <= 100. If sbd knows why (maybe a randomized algorithm that garantees the solution is never the same as the input string even tho it isn't asked in the problem) but please tell me I am curious


  • 0
    hajarel  commented on March 12, 2021, 12:36 a.m.

    j'ai pas compris le concept de la correction automatique de l'algo.. puisque il m'a donné le même résultat comme écrit en haut!!!


    • 0
      AkramElOmrani  commented on March 22, 2021, 2:18 p.m.

      J'ai vu votre code dans le input('entrer .....') vous ne devez pas afficher un message laisser le vide : input()


  • 1
    SAKIF  commented on Oct. 18, 2020, 12:45 p.m.

    Bonjour, J'ai pas bien compris le problème, est ce que par exemple on doit donner 4 chaines de caractères et puis on donne nous-même une autre chaine de caractères et le programme doit comparer cette dernière chaine avec les 4 premières chaines ? Merci pour votre aide

    Hello, I didn't understand the problem well, for example, do we have to give 4 strings of characters and then we give another string of characters and the program must compare this last string with the first 4 strings? Thanks for help.


    • 0
      moncef  commented on Oct. 18, 2020, 2:41 p.m.

      The first line will tell you how many strings you need to process, this number is T; Then for each string from 1 to T you need to output an equivalent string.


      • 1
        SAKIF  commented on Oct. 18, 2020, 5:48 p.m.

        Bonsoir si moncef pouvez-vous m'expliquer le problème en détails? merci beaucoup


        • 0
          aymanrs  commented on Oct. 23, 2020, 4:21 p.m.

          tu as T le nombre de chaines a traiter. pour chaque chaine tu dois afficher une chaine de meme "sens" c'est a dire une chaine qui a le meme nombre de chaque caractere (un permutation de la chaine initiale en gros)


  • 1
    LesQuarantaines  commented on May 1, 2020, 4:44 a.m.

    If the string X is composed on only one caracter ? ex: AAAAAA


    • 1
      code06  commented on Aug. 4, 2020, 2:55 p.m.

      Then the output would be the same string