From e3796e6995c26d29b13e12de13f8fb7a40c358cd Mon Sep 17 00:00:00 2001 From: suman276 <61776255+suman276@users.noreply.github.com> Date: Sun, 20 Dec 2020 14:52:30 +0530 Subject: [PATCH] Day 6 solution --- DSA Marathon/Day 6/Day 6 solution | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 DSA Marathon/Day 6/Day 6 solution diff --git a/DSA Marathon/Day 6/Day 6 solution b/DSA Marathon/Day 6/Day 6 solution new file mode 100644 index 0000000..d991907 --- /dev/null +++ b/DSA Marathon/Day 6/Day 6 solution @@ -0,0 +1,29 @@ +#include +#include +#include +using namespace std; + +int main(){ + int cases; + cin>>cases; + while(cases>0){ + string a; + int count=0; + cin>>a; + sort(a.begin(), a.end()); + int p1=1; + int p2=2; + while(p2<=a.size()){ + if(a[p1]!=a[p2]){ + count++; + p1=p2; + } + else + p2++; + } + + cout<