- #include<stdio.h>
- #include<string.h>
- int main()
- {
- int i,a,b,c,x,z;
- char n[200];
- scanf("%s",&n);
- x=strlen(n);
- i=0;a=0;b=0;c=0;
- while (i<x)
- {
- if (n[i]=='1') a++;
- else if (n[i]=='2') b++;
- else if (n[i]=='3') c++;
- i+=2;
- }
- i=0;z=0;
- while (i<a)
- {
- if (i==0) printf("1");
- else printf("+1");
- i++;
- z++;
- }
- i=0;
- while (i<b)
- {
- if (z==0) printf("2");
- else printf("+2");
- i++;
- z++;
- }
- i=0;
- while (i<c)
- {
- if (z==0) printf("3");
- else printf("+3");
- i++;
- z++;
- }
- printf("\n");
- return 0;
- }
Tuesday, January 21, 2020
Codeforces 339A Helpful Maths Solution in C
Subscribe to:
Post Comments (Atom)
Codeforces 131A cAPS lOCK Solution in C
#include <stdio.h> int main () { char ch [ 106 ]; int i , j , ck = 1 ; scanf ( "%s" , ch ); ...
-
#include <stdio.h> #include <string.h> int main () { int i , n , l = 0 ; char a [ 120 ]; scanf ( ...
-
#include <stdio.h> int main () { int o , n , a , b , c , s , t , u ; s = 0 ; t = 0 ; u = 0 ...
-
#include <stdio.h> #include <string.h> int main () { int i , n , p = 0 ; char s [ 120 ]; scanf ( ...
No comments:
Post a Comment