Information exposure through query strings in url of a POST request [duplicate]

I can’t seem to find any information online for when there is information exposure through query strings in URL of a POST request.

I understand it is an issue for when it’s sent in HTTP GET. Wondering if it would still be an issue for when it’s sent in POST?

e.g.

POST /api/view?username=USER 

How can I hide a flag from `strings` command

I want to create RE CTF, that the user needs to discover which string he need to write in order to execute a function that will print the flag, but, with a simple strings command in shell, we can discover the flag in the printf function. So, how can we make this not to happen?

#include <stdio.h>  void print_flag() {     printf("secret_string discovered. flag: {eAsy_p3asy}"); }  int main() {     int c;     c = getchar();     while (c != 'secret_string') {         putchar(c);         c = getchar();     }     print_flag();     return 0; } 

strings output: I include only the flag. I don’t want the flag to be visible like this, it makes no sense.

secret_string discovered. flag: {eAsy_p3asy} 

What is the most efficient way to turn a list of directory path strings into a tree?

I’m trying to find out the most efficient way of turning a list of path strings into a hierarchical list of hash maps tree using these rules:

  • Node labels are delimited/split by ‘/’
  • Hash maps have the structure:
{     label: "Node 0",     children: [] } 
  • Node labels are also keys, so for example all nodes with the same label at the root level will be merged

So the following code:

[     "Node 0/Node 0-0",     "Node 0/Node 0-1",     "Node 1/Node 1-0/Node 1-0-0" ] 

Would turn into:

[     {         label: "Node 0",         children: [             {                 label: "Node 0-0",                 children: []             },             {                 label: "Node 0-1",                 children: []             },         ]     },     {         label: "Node 1",         children: [             {                 label: "Node 1-0",                 children: [                     {                         label: "Node 1-0-0",                         children: []                     },                 ]             },         ]     }, ] 

Need help with Trie insertions, I am currently working on a DSA specialization on Coursera, Strings course

I am trying the insertion operation in a Trie and a read operation for the below implementation I am having trouble with insertion.

import java.util.*; class node{ public int val; public node ptrs[]; node(){     this.val =0;     ptrs = new node[26];     for (node ptr : ptrs) {         ptr = null;     }   }     } class Tree{ public node root = new node(); public int pass =0; void insert(String s) {     node trv = root;     for (int i = 0; i < s.length(); i++) {         if (trv.ptrs[s.charAt(i) - 'A'] == null) {             trv.ptrs[s.charAt(i) - 'A'] = new node();             trv.val = ++pass;           //  System.out.println(s.charAt(i)+" val : "+trv.val);         }          trv = trv.ptrs[s.charAt(i) - 'A'];     } } private void visit(node trv){     for(int i =0;i<26;i++){         if(trv.ptrs[i]!=null){             System.out.println((char)(i+'A')+" : "+trv.val);             visit(trv.ptrs[i]);         }     } } void call(){     this.visit(root);  }  } public class trie {   public static void main(String[] args) {     Scanner sc = new Scanner(System.in);     int n = sc.nextInt();     Tree t = new Tree();     while (n-- > 0) {         String s = sc.next();         t.insert(s);     }     t.call();     sc.close();  } } 

my output :

3 ATAGA ATC GAT A : 7 T : 2 A : 6 G : 4 A : 5 C : 6 G : 7 A : 8 T : 9 

expected output :

3 ATAGA ATC GAT A : 1 T : 2 A : 3 G : 4 A : 5 C : 6 G : 7 A : 8 T : 9 

Is there a way to map the concatenation operation over strings to the addition operation over $\mathbb{N}$

Given an alphabet, say $ \Sigma = \{0,1\}$ , I can make a one-to-one mapping from all possible strings $ x \in \Sigma^*$ to $ \mathbb{N}$ . This could be done by ordering $ \Sigma^*$ lexicographically and assigning the $ i$ th string $ x_i$ to number $ i \in \mathbb{N}$ .

But given strings $ x_i,x_j \in \Sigma^*$ , is there any special mapping such that the concatenation operation $ f:\Sigma^* \rightarrow \Sigma^* | (x_i,x_j) \rightarrow x_ix_j$ is also related to the usual addition performed over the corresponding indices $ i,j \in \mathbb{N}$ to which $ x_i$ and $ x_j$ are mapped ?

For instance, if I assign the character $ \{1\}$ to the number $ 1$ , and string $ x$ is assigned the number $ 10$ , is there a mapping such that the string $ x1$ is assigned the number $ 11$ ? (i.e. $ 10 + 1$ )

Strings and Lcp

We are given a string S with |S|=N
We have to answer Q queries
Each query has an integer x as input
We have to report
$ \sum_{i=x}^n LCP(i,x)$
Where Lcp(i,x) denotes the length of the largest common prefix of suffix[i,N] and suffix[x,N]

Strings and suffix

How can we find the sum of sizes of common prefix that a suffix of length r has with all suffices of length greater than r? We have to find this answer for all r. I tried this using suffix trees and got an O(n^2) algorithm where n is the length of the string. The main problem I could not handle was the restriction that only suffice of length greater than r were to be considered.

Strings in python

How to find a specified letter follows an another letter or not. eg; the input is : ‘hi, how are you?’,’h’,’i’ then the output is true, because i followed by h at least one time .