`{"id":"262201da-b75e-4bbe-8d66-f7e9b4022b54","name":"Abbreviation Using Backtracking","description":"1. You are given a word.\r\n2. You have to generate all abbrevations of that word.\r\n\r\nUse recursion as suggested in question video","inputFormat":"A string representing a word","outputFormat":"Check the sample ouput and question video.","constraints":"1 &lt;= length of string &lt;= 32","sampleCode":{"cpp":{"code":"#include<iostream>\nusing namespace std;\n void solution(string str, string asf,int count, int pos)\n {\n // write your code here\n }\n\tint main() {\n string str;\n cin >> str;\n solution(str,\"\",0,0);\n return 0;\n }"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void solution(String str, String asf,int count, int pos){\r\n //write your code here\r\n \r\n }\r\n\tpublic static void main(String[] args) {\r\n Scanner scn = new Scanner(System.in);\r\n String str = scn.nextLine();\r\n solution(str,\"\",0,0);\r\n }\r\n \r\n \r\n}"},"python":{"code":""}},"points":10,"difficulty":"medium","sampleInput":"pep","sampleOutput":"pep\r\npe1\r\np1p\r\np2\r\n1ep\r\n1e1\r\n2p\r\n3","questionVideo":"https://www.youtube.com/embed/LliQjLnbhx8?start=0&end=148","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":"082986ae-d618-4a59-9ab3-6d79056679a4","name":"Recursion and Backtracking For Intermediate","slug":"recursion-and-backtracking-for-intermediate-330","type":0},{"id":"d38ed187-18ca-4b52-add0-0063c038c323","name":"Abbreviation Using Backtracking","slug":"abbreviation-using-backtracking","type":1}],"next":{"id":"191425fc-61ab-407b-945d-eee88fcb2dac","name":"Abbreviation Using Backtracking MCQ","type":0,"slug":"abbreviation-using-backtracking-mcq"},"prev":null}}`

# Abbreviation Using Backtracking

1. You are given a word. 2. You have to generate all abbrevations of that word. Use recursion as suggested in question video

`{"id":"262201da-b75e-4bbe-8d66-f7e9b4022b54","name":"Abbreviation Using Backtracking","description":"1. You are given a word.\r\n2. You have to generate all abbrevations of that word.\r\n\r\nUse recursion as suggested in question video","inputFormat":"A string representing a word","outputFormat":"Check the sample ouput and question video.","constraints":"1 &lt;= length of string &lt;= 32","sampleCode":{"cpp":{"code":"#include<iostream>\nusing namespace std;\n void solution(string str, string asf,int count, int pos)\n {\n // write your code here\n }\n\tint main() {\n string str;\n cin >> str;\n solution(str,\"\",0,0);\n return 0;\n }"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void solution(String str, String asf,int count, int pos){\r\n //write your code here\r\n \r\n }\r\n\tpublic static void main(String[] args) {\r\n Scanner scn = new Scanner(System.in);\r\n String str = scn.nextLine();\r\n solution(str,\"\",0,0);\r\n }\r\n \r\n \r\n}"},"python":{"code":""}},"points":10,"difficulty":"medium","sampleInput":"pep","sampleOutput":"pep\r\npe1\r\np1p\r\np2\r\n1ep\r\n1e1\r\n2p\r\n3","questionVideo":"https://www.youtube.com/embed/LliQjLnbhx8?start=0&end=148","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":"082986ae-d618-4a59-9ab3-6d79056679a4","name":"Recursion and Backtracking For Intermediate","slug":"recursion-and-backtracking-for-intermediate-330","type":0},{"id":"d38ed187-18ca-4b52-add0-0063c038c323","name":"Abbreviation Using Backtracking","slug":"abbreviation-using-backtracking","type":1}],"next":{"id":"191425fc-61ab-407b-945d-eee88fcb2dac","name":"Abbreviation Using Backtracking MCQ","type":0,"slug":"abbreviation-using-backtracking-mcq"},"prev":null}}`

Editor

# Abbreviation Using Backtracking

medium

1. You are given a word. 2. You have to generate all abbrevations of that word. Use recursion as suggested in question video

## Constraints

1 <= length of string <= 32

## Format

### Input

A string representing a word

### Output

Check the sample ouput and question video.

## 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;}pep`

### 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;}pep pe1 p1p p2 1ep 1e1 2p 3```

Question Video

Discussions

Show Discussion

Related Resources