MCPcopy Create free account
hub / github.com/Jonathan-Uy/CSES-Solutions / main

Function main

String Algorithms/String Transform.cpp:9–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7char S[maxN];
8
9int main(){
10 scanf(" %s", S);
11 N = (int) strlen(S);
12 for(int i = 0; i < N; i++) nxt[i] = i;
13 stable_sort(nxt, nxt+N, [](int a, int b){
14 return S[a] < S[b];
15 });
16
17 int ptr = nxt[0];
18 while(ptr != 0){
19 ptr = nxt[ptr];
20 printf("%c", S[ptr]);
21 }
22}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected