Is there a mathematical way to know exactly how many substrings , prefixes , suffixes does a string have. for example w=“abbcc”

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












My trials were for prefixes and suffixes including the empty string for "abbcc" were equal to the (length_of_the_string + 1) but I couldn't figure out a way for calculating the number of substrings .







share|cite|improve this question
























    up vote
    0
    down vote

    favorite












    My trials were for prefixes and suffixes including the empty string for "abbcc" were equal to the (length_of_the_string + 1) but I couldn't figure out a way for calculating the number of substrings .







    share|cite|improve this question






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      My trials were for prefixes and suffixes including the empty string for "abbcc" were equal to the (length_of_the_string + 1) but I couldn't figure out a way for calculating the number of substrings .







      share|cite|improve this question












      My trials were for prefixes and suffixes including the empty string for "abbcc" were equal to the (length_of_the_string + 1) but I couldn't figure out a way for calculating the number of substrings .









      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Oct 30 '14 at 17:14









      Beeee

      1




      1




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Do you mean how many distinct substrings or do you allow duplicates? If you wish to count distinct substrings, the answer depends on the particular string. I will address the latter question, the number of substrings allowing duplicates.



          A substring is defined by a start index and an end index. Let the start index be the index of the first character in the substring and the end index be the index of the first character after the end of the string. Index characters starting at 1 (so the first character has index 1).



          If a string has length $n$, there are $n+1$ possible start indices ranging from 1 to $n+1$ where $n+1$ means the substring starts after the end of the string (and thus must be empty). Given a start index $s$, there are $n+2-s$ possible end indices ranging from $s$ to $n+1$, meaning $n+2-s$ substrings starting at index $s$. You must sum this quantity over all possible choices of $s$:



          $$sum_s=1^n+1n+2-s = (n+1)(n+2) - frac(n+1)(n+2)2 = frac(n+1)(n+2)2.$$






          share|cite|improve this answer




















          • no I don't allow duplicates when I calculated it by writing down all the possibilities they were 14 for "abbcc" which are epislon, a, b, c, ab, abb, abbc, abbcc, bb, bbc, bbcc, bc, bcc, cc
            – Beeee
            Oct 30 '14 at 17:31










          • If you don't allow duplicates then my answer gives the maximum possible number of substrings and the minimum possible number is $n+1$, which occurs on the string consisting of one character repeating $n$ times.
            – Solomonoff's Secret
            Oct 30 '14 at 17:37










          Your Answer




          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "69"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f998559%2fis-there-a-mathematical-way-to-know-exactly-how-many-substrings-prefixes-suf%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          Do you mean how many distinct substrings or do you allow duplicates? If you wish to count distinct substrings, the answer depends on the particular string. I will address the latter question, the number of substrings allowing duplicates.



          A substring is defined by a start index and an end index. Let the start index be the index of the first character in the substring and the end index be the index of the first character after the end of the string. Index characters starting at 1 (so the first character has index 1).



          If a string has length $n$, there are $n+1$ possible start indices ranging from 1 to $n+1$ where $n+1$ means the substring starts after the end of the string (and thus must be empty). Given a start index $s$, there are $n+2-s$ possible end indices ranging from $s$ to $n+1$, meaning $n+2-s$ substrings starting at index $s$. You must sum this quantity over all possible choices of $s$:



          $$sum_s=1^n+1n+2-s = (n+1)(n+2) - frac(n+1)(n+2)2 = frac(n+1)(n+2)2.$$






          share|cite|improve this answer




















          • no I don't allow duplicates when I calculated it by writing down all the possibilities they were 14 for "abbcc" which are epislon, a, b, c, ab, abb, abbc, abbcc, bb, bbc, bbcc, bc, bcc, cc
            – Beeee
            Oct 30 '14 at 17:31










          • If you don't allow duplicates then my answer gives the maximum possible number of substrings and the minimum possible number is $n+1$, which occurs on the string consisting of one character repeating $n$ times.
            – Solomonoff's Secret
            Oct 30 '14 at 17:37














          up vote
          0
          down vote













          Do you mean how many distinct substrings or do you allow duplicates? If you wish to count distinct substrings, the answer depends on the particular string. I will address the latter question, the number of substrings allowing duplicates.



          A substring is defined by a start index and an end index. Let the start index be the index of the first character in the substring and the end index be the index of the first character after the end of the string. Index characters starting at 1 (so the first character has index 1).



          If a string has length $n$, there are $n+1$ possible start indices ranging from 1 to $n+1$ where $n+1$ means the substring starts after the end of the string (and thus must be empty). Given a start index $s$, there are $n+2-s$ possible end indices ranging from $s$ to $n+1$, meaning $n+2-s$ substrings starting at index $s$. You must sum this quantity over all possible choices of $s$:



          $$sum_s=1^n+1n+2-s = (n+1)(n+2) - frac(n+1)(n+2)2 = frac(n+1)(n+2)2.$$






          share|cite|improve this answer




















          • no I don't allow duplicates when I calculated it by writing down all the possibilities they were 14 for "abbcc" which are epislon, a, b, c, ab, abb, abbc, abbcc, bb, bbc, bbcc, bc, bcc, cc
            – Beeee
            Oct 30 '14 at 17:31










          • If you don't allow duplicates then my answer gives the maximum possible number of substrings and the minimum possible number is $n+1$, which occurs on the string consisting of one character repeating $n$ times.
            – Solomonoff's Secret
            Oct 30 '14 at 17:37












          up vote
          0
          down vote










          up vote
          0
          down vote









          Do you mean how many distinct substrings or do you allow duplicates? If you wish to count distinct substrings, the answer depends on the particular string. I will address the latter question, the number of substrings allowing duplicates.



          A substring is defined by a start index and an end index. Let the start index be the index of the first character in the substring and the end index be the index of the first character after the end of the string. Index characters starting at 1 (so the first character has index 1).



          If a string has length $n$, there are $n+1$ possible start indices ranging from 1 to $n+1$ where $n+1$ means the substring starts after the end of the string (and thus must be empty). Given a start index $s$, there are $n+2-s$ possible end indices ranging from $s$ to $n+1$, meaning $n+2-s$ substrings starting at index $s$. You must sum this quantity over all possible choices of $s$:



          $$sum_s=1^n+1n+2-s = (n+1)(n+2) - frac(n+1)(n+2)2 = frac(n+1)(n+2)2.$$






          share|cite|improve this answer












          Do you mean how many distinct substrings or do you allow duplicates? If you wish to count distinct substrings, the answer depends on the particular string. I will address the latter question, the number of substrings allowing duplicates.



          A substring is defined by a start index and an end index. Let the start index be the index of the first character in the substring and the end index be the index of the first character after the end of the string. Index characters starting at 1 (so the first character has index 1).



          If a string has length $n$, there are $n+1$ possible start indices ranging from 1 to $n+1$ where $n+1$ means the substring starts after the end of the string (and thus must be empty). Given a start index $s$, there are $n+2-s$ possible end indices ranging from $s$ to $n+1$, meaning $n+2-s$ substrings starting at index $s$. You must sum this quantity over all possible choices of $s$:



          $$sum_s=1^n+1n+2-s = (n+1)(n+2) - frac(n+1)(n+2)2 = frac(n+1)(n+2)2.$$







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Oct 30 '14 at 17:22









          Solomonoff's Secret

          3,53811232




          3,53811232











          • no I don't allow duplicates when I calculated it by writing down all the possibilities they were 14 for "abbcc" which are epislon, a, b, c, ab, abb, abbc, abbcc, bb, bbc, bbcc, bc, bcc, cc
            – Beeee
            Oct 30 '14 at 17:31










          • If you don't allow duplicates then my answer gives the maximum possible number of substrings and the minimum possible number is $n+1$, which occurs on the string consisting of one character repeating $n$ times.
            – Solomonoff's Secret
            Oct 30 '14 at 17:37
















          • no I don't allow duplicates when I calculated it by writing down all the possibilities they were 14 for "abbcc" which are epislon, a, b, c, ab, abb, abbc, abbcc, bb, bbc, bbcc, bc, bcc, cc
            – Beeee
            Oct 30 '14 at 17:31










          • If you don't allow duplicates then my answer gives the maximum possible number of substrings and the minimum possible number is $n+1$, which occurs on the string consisting of one character repeating $n$ times.
            – Solomonoff's Secret
            Oct 30 '14 at 17:37















          no I don't allow duplicates when I calculated it by writing down all the possibilities they were 14 for "abbcc" which are epislon, a, b, c, ab, abb, abbc, abbcc, bb, bbc, bbcc, bc, bcc, cc
          – Beeee
          Oct 30 '14 at 17:31




          no I don't allow duplicates when I calculated it by writing down all the possibilities they were 14 for "abbcc" which are epislon, a, b, c, ab, abb, abbc, abbcc, bb, bbc, bbcc, bc, bcc, cc
          – Beeee
          Oct 30 '14 at 17:31












          If you don't allow duplicates then my answer gives the maximum possible number of substrings and the minimum possible number is $n+1$, which occurs on the string consisting of one character repeating $n$ times.
          – Solomonoff's Secret
          Oct 30 '14 at 17:37




          If you don't allow duplicates then my answer gives the maximum possible number of substrings and the minimum possible number is $n+1$, which occurs on the string consisting of one character repeating $n$ times.
          – Solomonoff's Secret
          Oct 30 '14 at 17:37

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f998559%2fis-there-a-mathematical-way-to-know-exactly-how-many-substrings-prefixes-suf%23new-answer', 'question_page');

          );

          Post as a guest













































































          這個網誌中的熱門文章

          Is there any way to eliminate the singular point to solve this integral by hand or by approximations?

          Why am i infinitely getting the same tweet with the Twitter Search API?

          Carbon dioxide