`{"id":"6b3076bf-b14d-46e3-a820-6234e6b7b347","name":"Count Distinct Subsequences","description":"1. You are given a string.\r\n2. You have to print the count of distinct and non-empty subsequences of the given string. \r\n\r\nNote -> String contains only lowercase letters.","inputFormat":"A String","outputFormat":"A number","constraints":"1 &lt;= length of string &lt;= 60","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.util.*;\r\n\r\npublic class Main{\r\n public static void main(String[] args){\r\n Scanner scn = new Scanner(System.in);\r\n String str = scn.next();\r\n \r\n //write your code here\r\n\r\n }\r\n}"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"abc","sampleOutput":"7\r\n","questionVideo":"https://www.youtube.com/embed/9UEHPiK53BA?end=147","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"5539a6e8-c8bf-4f04-805c-e43e9d20e72a","name":"Dynamic Programming For Intermediate","slug":"dynamic-programming-for-intermediate-408","type":0},{"id":"de8f4ef0-8b9d-4eac-a852-8211030f0dd4","name":"Count Distinct Subsequences","slug":"count-distinct-subsequences","type":1}],"next":{"id":"0e15c3b4-f4a7-4a06-a23e-0e11a0f7c7cb","name":"Count distinct subsequences MCQ","type":0,"slug":"count-distinct-subsequences-mcq"},"prev":{"id":"403d1235-0262-4b78-811c-2f23eecfbf8b","name":"Print All Results In 0-1 Knapsack","type":3,"slug":"print-all-results-in-0-1-knapsack"}}}`

Count Distinct Subsequences

1. You are given a string. 2. You have to print the count of distinct and non-empty subsequences of the given string. Note -> String contains only lowercase letters.

`{"id":"6b3076bf-b14d-46e3-a820-6234e6b7b347","name":"Count Distinct Subsequences","description":"1. You are given a string.\r\n2. You have to print the count of distinct and non-empty subsequences of the given string. \r\n\r\nNote -> String contains only lowercase letters.","inputFormat":"A String","outputFormat":"A number","constraints":"1 &lt;= length of string &lt;= 60","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.util.*;\r\n\r\npublic class Main{\r\n public static void main(String[] args){\r\n Scanner scn = new Scanner(System.in);\r\n String str = scn.next();\r\n \r\n //write your code here\r\n\r\n }\r\n}"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"abc","sampleOutput":"7\r\n","questionVideo":"https://www.youtube.com/embed/9UEHPiK53BA?end=147","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"5539a6e8-c8bf-4f04-805c-e43e9d20e72a","name":"Dynamic Programming For Intermediate","slug":"dynamic-programming-for-intermediate-408","type":0},{"id":"de8f4ef0-8b9d-4eac-a852-8211030f0dd4","name":"Count Distinct Subsequences","slug":"count-distinct-subsequences","type":1}],"next":{"id":"0e15c3b4-f4a7-4a06-a23e-0e11a0f7c7cb","name":"Count distinct subsequences MCQ","type":0,"slug":"count-distinct-subsequences-mcq"},"prev":{"id":"403d1235-0262-4b78-811c-2f23eecfbf8b","name":"Print All Results In 0-1 Knapsack","type":3,"slug":"print-all-results-in-0-1-knapsack"}}}`

Editor

Count Distinct Subsequences

easy

1. You are given a string. 2. You have to print the count of distinct and non-empty subsequences of the given string. Note -> String contains only lowercase letters.

Constraints

1 <= length of string <= 60

A String

A number

Example

Sample Input

`.css-23h8hz{color:inherit;font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;}abc`

Sample Output

```.css-3oaykw{color:var(--chakra-colors-active-primary);font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;font-family:Monospace;}7 ```

Question Video

Discussions

Show Discussion

Related Resources