the countandsay sequence sequence digit string define recursive formulacountandsay1 1countandsayn way digit string countandsayn1 convert different digit stringTo determine digit string split minimal number substring substring contain exactly unique digit then substre number digits digit finally concatenate say digitfor example say conversion digit string 3322251given positive integer n return nth term countandsay sequence Example 1input n 1output 1explanation this base caseExample 2Input n 4Output 1211ExplanationcountAndSay1 1countandsay2 1 1 11countandsay3 11 1s 21countandsay4 21 2 1 12 11 1211 Constraints1 n 30