Mikhail walks on a 2D plane. He can go either up or right. You are given a sequence of Mikhail's moves. He thinks that this sequence is too long and he wants to make it as short as possible.In the given sequence moving up is described by character U and moving right is described by character R. Mikhail can replace any pair of consecutive moves RU or UR with a diagonal move (described as character D). After that, he can go on and do some other replacements, until there is no pair of consecutive moves RU or UR left.Your problem is to print the minimum possible length of the sequence of moves after the replacements.

The first line of the input contains one integer n (1 ≤ n ≤ 100) — the length of the sequence. The second line contains the sequence consisting of n characters U and R.

Print the minimum possible length of the sequence of moves after all replacements are done.

NoteIn the first test the shortened sequence of moves may be DUD (its length is 3).In the second test the shortened sequence of moves can be UUDRRRDUDDUUU (its length is 13).

#include<stdio.h>
#include<string.h>
int main()
{
    int i,c=0,l,s=0,n;
    scanf("%d",&n);
    char str[n];
    scanf("%s",str);
    l=strlen(str);
    for(i=0;i<l;)
    {
        if(str[i]=='U' && str[i+1]=='R')
        {
            c++;
            i=i+2;
        }
        else if(str[i]=='R' && str[i+1]=='U')
        {
            c++;
            i=i+2;
        }
        else i++;
    }
    printf("%d",n-c);
    return 0;
}

#include <stdio.h>
#include<string.h>
int main()
{
	int i=0,count=0,n=0;
        scanf("%d",&n);
	char s[n];
	scanf("%s",s);
	for(i=0;i<n;)
	{
	if(s[i]=='U' && s[i+1]=='R'){
	 count++;i=i+2;
	}
        else if(s[i]=='R' && s[i+1]=='U')
	{
         count++;
	 i=i+2;
	}
        else{
	 count++;
	 i++;
	}}
        printf("%d",count);

}

#include<stdio.h>
#include<string.h>
int main()
{
    int i,n,sum=0;
    char a[110];
    scanf("%d",&n);
    scanf("%s",a);

    for(i=0;i<n-1;)
    {
        if(a[i]!=a[i+1])
        {
            sum=sum+1;
            i=i+2;

        }
        else{i++;}

    }
    printf("%d",n-sum);
    return 0;
}

#include <stdio.h>

int main()
{
    int n, j=0;
    scanf("%d", &n);
    char a[n+2];
    scanf("%s", a);
    for(int i=0; i<n-1; i++)
    {
        if(a[i]!=a[i+1])
        {
           j++;
           i++;
        }
    }
    printf("%d", n-j);
}

#include<stdio.h>
int main(){
	int leng,count=0,i=0;
	scanf("%d",&leng);
	char s[leng];
	scanf("%s",s);
	while(i<leng){
		if(s[i]!=s[i+1]){
			count++;i=i+2;
		}else if(s[i]==s[i+1]){
			count++;i++;
		}
	}
	printf("%d",count);
}

#include<stdio.h>
int main()
{
    int n,i,count=0;
    scanf("%d",&n);
    char s[n+1];
    scanf("%s",&s);
    for(i=0;i<n;i=i+0)
    {
        if(s[i]=='U')
        {
            if(s[i+1]=='R')
            {
                count=count+1;
                i=i+2;
            }
            else
            {
                i=i+1;
            }
        }
        else if(s[i]=='R')
        {
            if(s[i+1]=='U')
            {
                count=count+1;
                i=i+2;
            }
            else
            {
                i=i+1;
            }
        }
    }
    printf("%d",n-count);
}

#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    char a[n];
    scanf("%s",a);
    int i;
    int b=n;
    for(i=0;i<b-1;i++){
        if(a[i]!=a[i+1]){
            --n;
            i++;
        }
    }
    printf("%d",n);
    return 0;
}

#include<stdio.h>
#include<conio.h>

int main()
{
   char str[100];
   int len,ctr,count=0;
   scanf("%d",&len);
   scanf("%s",str);
   for( ctr = 0 ; ctr < len; )
   {
       if( str[ctr+1] != NULL )
       {
       if( str[ctr] == 'U'&& str[ctr+1] == 'R')
         {
             count++;
             ctr+=2;
         }
        else if( str[ctr] == 'R' && str[ctr+1]== 'U')
        {
            count++;
            ctr+=2;
        }
        else
        {
            ctr++;
            count++;
        }
       }
       else
       {
       count++;
       ctr++;
       }
   }

   printf("%d",count);
}

#include<stdio.h>
#include<string.h>
int main()
{
    int a,s,d,f,g,h,j,k,l;
    scanf("%d",&a);
    d=a;
    char lol[a+1];
    scanf("%s",&lol);
    for(s=0;s<a-1;s++)
    {
        if(lol[s]!=lol[s+1])
            d--,s++;
    }
    printf("%d",d);
}

#include<stdio.h>
#include<string.h>

int main(){

    char str[100];
    int count=0,i,n;
    scanf("%d",&n);
    scanf("%s",str);
    for(i=0;i<n-1;){
        if((str[i]=='R' && str[i+1]!='R') || (str[i]=='U' && str[i+1]!='U')){
        i=i+2;
        count++;
        }
        else{
            i++;
        }
    }
printf("%d\n",n-count);
    return 0;
}

#include<stdio.h>
#include<string.h>

char a[200];
int main()
{
    int n,sum1= 0,sum2=0;
    scanf("%d",&n);
    scanf("%s",a);
    for(int i = 0 ; i < n; i++)
    {
        int k;
        if(!sum2)
        {
            if(a[i]=='U')
                sum2 = 1;
            else sum2 = 2;
            sum1++;
        }
        else
        {
            if(a[i] == 'U')
                k = 1;
            else k = 2;
            if(k!=sum2){
                sum2 = 0;
            }
            else
                sum1++;
        }
    }
    printf("%d\n",sum1);
}

#include<stdio.h>
#include<string.h>
int main(void)
{
    int n;
    scanf("%d",&n);
    scanf("%*c");
    char str[n+1];
    gets(str);
    int i,j,k,l;
    for(i=0; i<n; i++)
    {
        if((str[i]=='R' && str[i+1]=='U') || (str[i]=='U' && str[i+1]=='R'))
        {
            str[i]='1';
            str[i+1]='D';
        }
    }
    int count=0;
    for(i=0; i<n; i++)
    {
        if(str[i]=='U' || str[i]=='D' || str[i]=='R')
        {
            count++;
        }
    }
    printf("%d",count);
    return 0;
}

int main() {
	long n, len, i,NUM;
	scanf("%ld", &n);
	char str[101];
	scanf("%s", str);
	for (i = 0; i < n - 1; i++)
		if (str[i] != str[i + 1]&&str[i]!='D') {
			str[i] = 'n';
			str[i + 1] = 'D';
		}
	NUM = 0;
	for (i = 0; i < n; i++)
		if (str[i] != 'n')
			NUM++;
	printf("%ld\n", NUM);
	return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#include<math.h>

int main()
{
    int n, count=0;
    scanf("%d", &n);
    char str[n+2];
    scanf("%s", str);  // 0 hole unchecked
    int len= strlen(str);

    int flag[n];
    memset(flag, 0, n*sizeof(int));

   for(int i=0 ; i<len ; i++){
        if((str[i]=='R' && str[i+1]== 'U')||(str[i]== 'U' && str[i+1]== 'R')){
            if(flag[i]==0 && flag[i+1]==0){
                count++;
                flag[i]=1;
                flag[i+1]=1;
            }
        }
    }

    printf("%d", n-count);

    return 0;
}

#include <stdio.h>

int main()
{
	int n,c=0;
	scanf("%d",&n);
	char a[n];
	scanf("%s",a);
	for(int i=0;i<n-1;i++)
	{
		if(a[i]!=a[i+1])
		{
			c++;
			i++;
		}

	}
	printf("%d",n-c);
	return 0;
}

#include <stdio.h>

int main()
{
    int n, i, ans=0;
    char s[101];
    scanf("%d %s", &n, s);
    for(i=0; i<n; i++)
    {
        if(s[i] != s[i+1])
            ans++, i++;
        else
            ans++;
    }
    printf("%d\n", ans);

    return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
    int n,n1,count=0,x;
    char s[101];
    scanf("%d ",&n);

    for(int i=0;i<n;i++)
    {
        scanf("%c",&n1);
        s[i]=n1;
    }
    for(int j=0;j<n;j++)
    {
        x=j+1;
        for(int k=x;k<=x;k++)
        {

            if(s[j]==s[k])
            {
                count++;
            }
            else{
                j++;
                count++;
            }
        }
    }
    printf("%d\n",count);
    return 0;

}

#include<stdio.h>
#include<stdlib.h>

int main()
{
  int n;
  scanf("%d",&n);
  char* s=(char*)malloc(sizeof(char)*n);
  int i,c=n;
  for(i=0;i<n;i++)
    scanf(" %c",&s[i]);
  for(i=0;i<n;++i)
  {
    if((s[i]=='R' && s[i+1]=='U')||(s[i]=='U' && s[i+1]=='R'))
    {c--; i++;}
  }
  printf("%d",c);
  return 0;
}

#include<stdio.h>
int main()
{
    int i,n;
    char ch[101];
    scanf("%d",&n);

    scanf("%s",&ch);

    for(i=0;ch[i]!='\0';i++)  //condition is not i<n caz n will be decreased
    {
        if(ch[i]=='R' && ch[i+1]=='U')
        {
            n--;
            i++;
        }
        else if(ch[i]=='U' && ch[i+1]=='R')
        {
            n--;
            i++;
        }
    }
    printf("%d",n);
    return 0;
}

#include<stdio.h>
int main()
{
int n,i,c=0;
char s[100];
scanf("%d",&n);
scanf("%s",s);
for(i=1;i<n;i++)
{
	if(s[i]!=s[i-1])
	{
	    i++;
	    c++;
	}
}
printf("%d",n-c);
return 0;
}

#include<stdio.h>
#include<string.h>
int main ()
{
    int i,count=0,n,j,k ;

    scanf("%d",&n) ;
    char s[n] ;
    scanf("%s",s) ;

    j=strlen(s) ;

    for(i=0;s[i]!='\0';i++)
    {
        if(s[i]=='R'&& s[i+1]=='U'||s[i]=='U'&& s[i+1]=='R')
           {
               count++ ;
               i++ ;
           }

         //  printf("%d   ",count ) ;
    }
    //printf("\n%d",count+1) ;
    k= j-count ;

    printf("%d",k) ;

    return 0 ;
}

#include<string.h>
#include<stdio.h>
int main()
{
int n,i=0,mov=0;
scanf("%d",&n);
char str[n];
scanf("%s",str);
	while(i<n)
{

	if((str[i]=='U'&& str[i+1]=='R')||(str[i]=='R'&& str[i+1]=='U'))
	{
	       mov++;
		i=i+2;
	}
	else{
		mov=mov+1;;
		i++;
	   }
	}
printf("%d",mov);
return 0;

}

#include <stdio.h>

int main()
{
	int n;
	char mt[150];
	scanf("%d", &n);
	scanf("%s", &mt, 150);
	int num;
	num = n;
	int i;
	for (i = 0; i < n - 1; i++)
	{
		if (mt[i] != mt[i + 1])
		{
			num -= 1;
			i += 1;
		}
	}
	printf("%d", num);
}

#include<stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	int i,sum=0;
	char a='D',b;
	getchar();
	for(i=0;i<n;i++)
	{

		scanf("%c",&b);
		if((a=='U'&&b=='R')||(a=='R'&&b=='U'))
		{
			a='D';
		}
		else
		{
			a=b;
			sum++;
		}
	}
	printf("%d\n",sum);
	return 0;
}

#include <stdio.h>
#include <string.h>

int main()
{
    int n,i,count=0;
    scanf("%d",&n);
    getchar();
    char ch[n+5];
    gets(ch);
    for(i=0;i<n;i++)
    {
        if((ch[i]=='U' && ch[i+1]=='R') || (ch[i]=='R' && ch[i+1]=='U'))
        {
            count++;
            i=i+1;
        }
    }
    printf("%d\n",n-count);
    return 0;
}

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main (void){
  char* path;
  int n,i,cnt=0;
  scanf("%d",&n);
  path=(char*)calloc(n,sizeof(char));
  getchar();
  scanf("%s",path);
  for(i=0;i<n;i++){
    if(path[i]==path[i+1])
      cnt++;
    else{
      cnt++;
      i++;
    }
  }
  printf("%d",cnt);
  return 0;
}

#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
    int n,k=0,i,j;
    scanf("%d",&n);
    char S[n];
    scanf("%s",&S);
    for(i=0;i<n;i++)
    {
        if((S[i]=='U'&&S[i+1]=='R')||(S[i]=='R'&&S[i+1]=='U'))
        {
            k++;
            i++;
        }
    }
    printf("%d\n",n-k);
    return 0;
}

/*
 * diagonalwalk.c
 *
 * Copyright 2019 Ravi Teja <Ravi Teja@DESKTOP-NNTRDO1>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 *
 *
 */

#include <stdio.h>

int main(int argc, char **argv)
{ int n,i,c=0;
	scanf("%d",&n);
	char a[n];
	scanf("%s",a);
	for(i=0;i<n-1;i++){
		if(a[i]!=a[i+1]){
			c=c+1;
			i=i+1;
		}
	}
	printf("%d",n-c);

	return 0;
}

/*Problem 954A Diagonal Walk*/
#include <stdio.h>
int main()
{
    int n, moves, i;
    char str[100];
    scanf("%d", &n);
    scanf("%s", str);
    moves = n;

    for (i = 0; i < n; i++)
    {
        if (i == n - 1)
            break;
        if (str[i] != str[i + 1])
        {
            moves--;
            i++;
        }
    }
    printf("%d", moves);
    return 0;
}

#include<stdio.h>
char a[101];
int s=0,i=0,n;
int main()
{
scanf("%d",&n);
scanf("%s",a);
while (i<n)
   {
   	if (a[i]==a[i+1])
   	   {
   	   s++;
   	   i++;
   	   }
   	   else
   	   {
   	   	s++;
   	   	i+=2;
   	   }
   }
   printf("%d",s);

   return 0;
}

#include<stdio.h>
int main(){
	int leng,count=0,i=0;
	scanf("%d",&leng);
	char s[leng];
	scanf("%s",s);
	while(i<leng){
		if(s[i]!=s[i+1]){
			count++;i=i+2;
		}else if(s[i]==s[i+1]){
			count++;i++;
		}
	}
	printf("%d",count);
}

#include <stdio.h>
#include <string.h>

int main()
{
	int n,i,j ;
	char ch[1000], ch1[1000]="";
	do {scanf("%d",&n);} while((n<1)||(n>100));
	int b = 0 ;
	do
	{i=0 ;
	scanf("%s",ch);
		while(i<strlen(ch))
			if ((ch[i] == 'U') || (ch[i] == 'R')) {i++; b=1; } else {b=0; break ;}
	} while((b==0) || (strlen(ch) != n)) ;
	i=0 ;
	j=0;

	while(i<n) {
			if(ch[i] != ch[i+1]){strcat(ch1,"D") ; i=i+2; j++;}
			else{ch1[j]=ch[i] ; i++ ;j++;}

	 }
	int k = strlen(ch1);
	printf("%d",k);

return 0 ;
}

#include<stdio.h>
#define sf scanf
#define pf printf
int main()
{
    int n,i,count=0;
    sf("%d",&n);
    char s[n];
    sf("%s",s);
    for(i=1;i<n;i++)
    {
        if(s[i]!=s[i-1])
        {
            i++;
            count++;
        }
        //pf("%d\n",count);
    }
    pf("%d",n-count);
}

#include<stdio.h>
#include<stdlib.h>
int fun(char *,int );
int fun(char *s,int n)
{
    int i=0,cnt=n;
    while(i<n-1)
    {
        if(s[i]!=s[i+1])
        {
            cnt--;
            i=i+2;
        }
        else
        {
            i++;
        }
    }
    return cnt;
}
int main()
{
    char a[101];
    int n;
    scanf("%d%s",&n,a);
    printf("%d\n",fun(a,n));
    return 0;
}

#include<stdio.h>
int main()
{
    int i,j=0,k=0,n,U,R;
	char a[100];

	scanf("%d %s",&n,a);

	for(i=j;i<n;i=j){
		for(j=i+1;j<n;j++){

	if(a[i]!=a[j])
	{
	k++;
	j++;
	break;
	}

	else
	break;
		}
	}
	printf("%d",n-k);
	return 0;

}

#include <stdio.h>

int main()
{
    int n, i, ans=0;
    char s[101];
    scanf("%d %s", &n, s);
    for(i=0; i<n; i++)
    {
        if(s[i] != s[i+1])
            ans++, i++;
        else
            ans++;
    }
    printf("%d\n", ans);

    return 0;
}

#include<stdio.h>
int main()
{
int n,i,c=0;
char s[100];
scanf("%d",&n);
scanf("%s",s);
for(i=1;i<n;i++)
{
	if(s[i]!=s[i-1])
	{
	    i++;
	    c++;
	}
}
printf("%d",n-c);
return 0;
}

#include <stdio.h>

int main()
{
    int n,i,c;
    char inp[150];
    scanf("%d",&n);
    getchar();
    if((n>=1)&&(n<=100))
{   for(i=0;i<n;i++) scanf("%c",&inp[i]);
    for(i=0;i<n;i++)
    {
        if((inp[i]=='R')&&(inp[i+1]=='U')) { c++; i++; }
        else if((inp[i]=='U')&&(inp[i+1]=='R')) { c++; i++; }
        else { c++;}
    }
    printf("%d",c);
}   else printf("Enter the sequence between 1 to 100");
    return 0;
}

#include <stdio.h>
int main()
{
    int n,i,j,count=0;
    scanf("%d",&n);
    char ch[n];
    getchar();
    gets(ch);
    for(i=0;i<n;i++)
    {
        if(ch[i]!=ch[i+1])
        {
            i++;
        }
        count++;
    }
    printf("%d",count);
}

#include<stdio.h>
#include<string.h>
int main()
{
    int a,b,c,i;
    scanf("%d", &a);
    int m=a;
    getchar();
    char ar[a];
    gets(ar);

    for(i=0; i<a; i++)
    {
        if(i+1<a&&ar[i] != ar[i+1])
        {
            m--;
            i++;
        }
    }
    printf("%d\n", m);
}

#include <stdio.h>

#include <string.h>

int main()

{

    int n , count = 0 ;

    scanf("%d",&n) ; char ch = getchar() ;

    char ara[n] ;

    scanf("%[^\n]",ara) ;

    if( n == 1 )  {

        printf("1\n") ;

        return 0 ;

    }

    else  {

        for( int a = 0 ; a < (n-1) ; a++ )  {

if( (ara[a] == 'R' && ara[a+1] == 'U' ) || (ara[a] == 'U' && ara[a+1] == 'R' ) )  {

                count++ ; a+=1 ;

            }

        }
       // printf("%d\n",count) ;
        printf("%d\n",n-count) ;

    }

    return 0 ;

}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i,n,ans=0;
    char letters[100000];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf(" %c",&letters[i]);
    }
    for(i=0;i<n;i++)
    {
      if(letters[i]=='R'&&letters[i+1]=='U')
      {
          ans++;
          i++;
          continue;
      }
      if(letters[i]=='U'&&letters[i+1]=='R')
      {
          ans++;
          i++;
          continue;
      }
      ans++;
    }
    printf("%d",ans);
    return 0;
}

#include <stdio.h>
typedef float fl;
typedef char ch;
typedef long long ll;
#define rep(i,a,n) for(i=a;i<n;i++)
#define rev(i,n,a) for(i=n;i>=a;i--)
#define repr(i,a,b) for(i=a;i<b;i++)
#define s(n) scanf("%d",&n);
#define s2(n,m) scanf("%d%d",&n,&m);
#define s3(n,m,o) scanf("%d%d%d",&n,&m,&o);
#define p(n) printf("%d",n);
#define p2(n,m) printf("%d%d",n,m);
#define sc(n) scanf("%c",&n);
#define sf(n) scanf("%f",&n);
#define sl(n) scanf("%lld",&n);
#define pc(n) printf("%c",n);
#define pf(n) printf("%f",n);
#define pl(n) printf("%lld",n);
#define br break;
#define co continue;
#define ss(a) scanf("%s",&a);
#define ps(a) printf("%%s",a);
#define nl printf("\n");
#define r0 return 0;
int main()
{
    int n;
    s(n)
    ch a[n];
    ss(a)
    int i,y=0,z=0;
    for(i=0;i<n-1;)
    {
        if(a[i]=='U'&&a[i+1]=='R')
        {
            y++;
            i+=2;
        }
        else if(a[i]=='R'&&a[i+1]=='U')
        {
            y++;
            i+=2;
        }
        else
            i++;
    }
    p(n-y)
	r0
}

#include <stdio.h>
#include <string.h>

int main()
{
    int a,b,i,counter=0;
    scanf("%d",&a);
    char strng[a],result[a];

    scanf("%s",strng);

    for(i=0;i<strlen(strng);i++)
    {
        if(strng[i]=='R'&& strng[i+1]=='U' || strng[i]=='U'&& strng[i+1]=='R')
        {
            strng[i+1]='N';
        }
        if(strng[i]!='N')
        {
            counter++;
        }
    }

    printf("%d\n",counter);
    return 0;

}

#include<stdio.h>
#include<string.h>
int main()
{
	int n;
	scanf("%d", &n);

	char a[n];
	scanf("%s", a);

	int i, count=0, pair=0, solo=0;

	i=0;
	//printf("\n%d %d %d %d",i ,n , pair, solo);

	while(n>0)
	{
		if(a[i]=='R')
		{
			if(a[i+1]=='U')
			{
				pair++;
				n--;
				i++;
			}
			else if(a[i+1]=='R')
				solo++;
			else
				solo++;
		}
		else if(a[i]=='U')
		{
			if(a[i+1]=='R')
			{
				pair++;
				n--;
				i++;
			}
			else if(a[i+1]=='U')
				solo++;
			else
				solo++;
		}
		n--;
		i++;
		//printf("\n%d %d %d %d",i ,n , pair, solo);
	}
	count=pair+solo;
	printf("\n%d", count);
}

#include <stdio.h>
#include <stdbool.h>

#define minimum(x,y)((x)<(y) ? (x) : (y))
#define maximum(x,y)((x)>(y) ? (x) : (y))

int main()
{
    int n,i,res;
    bool wait;

    res = 0;
    wait = true;

    scanf("%d",&n);
    char s[n+1];
    for(i=0;i<n+1;i++){
        scanf("%c", &s[i]);
        // printf("%c and %d and %s PUTTED\n", s[i],i,(wait)?"True":"False");
        if((!(s[i]==s[i-1]))&&(wait)&&(i>1)){
            // printf("%c c %d\n", s[i],i);
            // printf("%c pc %d\n", s[i-1],i);
            res++;
            wait = false;
        }else{
            wait = true;
        }
    }
    printf("%d",n-res);

    return 0;
}

#include<stdio.h>
#include<string.h>
#define ll long long
#define MAX 101
int main()
{
	int n,ans=0;
	scanf("%d",&n);
	char str[n];
	scanf("%s",&str);
	for(int i=0;i<n;)
	{
		if(str[i]==str[i+1])
		{
		i++;
		ans++;
	    }
	    else if(str[i]!=str[i+1])
	    {
	    i+=2;
	    ans++;
		}
    }
    printf("%d\n",ans);
	return 0;
}

#include<stdio.h>
int main()
{
    int n,i,count=0;
    char str[319];
    scanf("%d",&n);
    scanf("%s",str);
    for(i=0;i<n;i++)
        if(str[i]=='R' && str[i+1]=='U' || str[i]=='U' && str[i+1]=='R')
            str[i+1]='0';

    for(i=0;i<n;i++)
        if(str[i]!='0') count++;

    printf("%d",count);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

void countCon(char *arr, int n);

int main(void){
  int n;
  scanf("%d", &n);
  char *path = (char *) malloc(sizeof(char) * (n + 1));
  scanf("%s", path);
  countCon(path, n);
}

void countCon(char *arr, int n){
  int i = 0;
  int count = 0;
  while(i < n - 1){
    if((int)*(arr+i) != (int)*(arr+i+1)){
      count++;
      i += 2;
    }
    else {
      i++;
    }
  }
  printf("%d\n", (n - count));
}

#include<stdio.h>
int main (){
    int n,i,all;
    char tit[101];
    scanf("%d",&n);
    all=0;
    getchar();
    gets(tit);
    for(i=0;i<strlen(tit)-1;){
        if(tit[i]!=tit[i+1]){
            i+=2;
            all++;
        }
        else
            i++;
    }
    printf("%d",n-all);
}

#include<stdio.h>
int main()
{
    int n,i,count=0,cout,out,result;
    scanf("%d",&n);
    char s[n];
    scanf("%s",&s);
    for(i=0;i<n;i++)
    {
        if(s[i]=='R'&& s[i+1]=='U')
        {
            count++;
            i++;
        }
        else if(s[i]=='U'&& s[i+1]=='R')
        {
            count++;
            i++;
        }}

        /*if(s[i]=='u'&& s[i+1]=='r' && s[i+2]=='u')
        {
            count--;
        }*/

    cout=count*2;
    result=n-cout;
    out=result+count;
    printf("%d",out);
    return 0;
}

#include <stdio.h>

int main(){
    int i,n,hasilD = 0,hasil = 0;
    scanf("%d",&n);
    char arr[n];
    scanf("%s",&arr);

    for(i = 0 ;i<n-1;i++){
        //printf("I SEKARANG : %d\n",i);
        if(arr[i] != arr[i+1]){
            hasilD++;
            i++;
        }

        }
    printf("%d",n-hasilD);
    return 0;
}

#include <stdio.h>
int main()
{
    int i,n,count=0;
    scanf("%d",&n);
    char s[n];
    scanf("%s",s);
    for(i=0;s[i]!='\0';i++)
    {
        if(s[i]=='U')
        {
            if(s[i+1]=='R')
            {
                count++;
                i++;
            }
            else
                count++;
        }
        else if(s[i]=='R')
        {
            if(s[i+1]=='U')
            {
                count++;
                i++;
            }
            else
                count++;
        }
    }
    printf("%d\n",count);
    return 0;
}

#include <stdio.h>
#define MAX 107

int main()
{
	int i, n, c = 0;
	char str[MAX];
	scanf("%d", &n);
	scanf("%s", str);
	for(i=0;i<n-1;++i)
	{
		if((str[i] == 'U' && str[i + 1] == 'R') || (str[i] == 'R' && str[i + 1] == 'U'))
		{
			++i;
			++c;
		}
	}
	printf("%d\n", n - c);
	return 0;
}

#include<stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	char data[n];
	scanf("%s",data);
	char prev = data[0];
	int cnt=0;
	for(int i=1;i<n;i++){
		if(data[i]!=prev){
			cnt++;
			i++;
			prev = data[i];
		}
	}
	printf("%d",n-cnt);
	return 0;
}

//http://codeforces.com/contest/954/problem/A
#include<stdio.h>
#include<math.h>
#include<string.h>
#define False 0
#define True 1
// int small(char ch)
// int capital(char ch);
// int prime(int number);
// void bubble_sort(int arr[], int n);
//void upper(char *ptr);
//void lower(char *ptr);
// void sort(char *ptr, int n);
// void RemoveDuplicates(char * arr, char * new_str, int arr_size);
// int Contains(char * arr, char elem, int arr_size);
// int Times_of_shapes(char * str, int len);

int main(void)
{

    int number, move=0, i;
    char str[101];
    scanf("%d", &number);
    scanf("%s", str);
    for(i=0;i<number;)
    {
    	if(str[i]==str[i+1])
    	{
    		move++;
    		i++;
    	}
    	else
    	{
    		i+=2;
    		move++;
    	}
    }
    printf("%d\n", move);

	return 0;
}

// int Times_of_shapes(char * str, int len)
// {

// 	int j, i, times=0, result=0;
// 	str[len]='\0';
// 	char temp[len][len+1];
// 	for(i=0;i<=len;i++)
// 	{
// 		temp[0][i]=str[i];
// 	}
// 	for(i=1;i<len;i++)
// 	{
// 		temp[i][0]=temp[i-1][len-1];
// 		for(j=1;j<len;j++)
// 		{
// 			temp[i][j]=temp[i-1][j-1];
// 		}
// 		temp[i][len]='\0';
// 	}

// 	for(i=0;i<len;i++)
// 	{
// 		times=0;
// 		for(j=i+1;j<len;j++)
// 		{
// 			if(strcmp(temp[i], temp[j])==False)
// 			{
// 				times++;
// 			}
// 		}
// 		if(times==False)
// 		{
// 			result++;
// 		}
// 	}
// 	return result;

// }

// int Contains(char * arr, char elem, int arr_size)
// {

//     int index = 0;

//     for(index = 0; index < arr_size; index++)
//     {

//         if(arr[index] == elem)
//         {
//             return True;
//         }
//     }

//     return False;

// }

// void RemoveDuplicates(char * arr, char * new_str, int arr_size)
// {

//     int index = 0, new_index = 0;

//     //clear temp string
//     for(index = 0; index < arr_size; index++)
//     {
//         new_str[index] = 0;
//     }

//     for(index = 0; index < arr_size; index++)
//     {

//         if(Contains(new_str, arr[index], arr_size) == False)
//         {
//             new_str[new_index] = arr[index];
//             new_index++;
//         }
//         if(index==arr_size-1)
//         {
//             new_str[new_index]='\0';
//         }
//     }

// }

// void sort(char *ptr, int n)
// {
// 	int i, j, temp;
// 	for(i=0;i<n-1;i++)
// 	{
// 		for(j=0;j<n-i-1;j++)
// 		{
// 			if(ptr[j]>ptr[j+1])
// 				{
// 					temp=ptr[j];
// 					ptr[j]=ptr[j+1];
// 					ptr[j+1]=temp;
// 				}

// 		}
// 	}

// }

/*
void upper(char *ptr)
{
	int i=0;
	while(ptr[i]!='\0')
	{
		if(ptr[i]>='a'&&ptr[i]<='z')
			ptr[i]-=32;
		i++;
	}

}*/

/*
void lower(char *ptr)
{
	int i=0;
	while(ptr[i]!='\0')
	{
		if(ptr[i]>='A'&&ptr[i]<='Z')
			ptr[i]+=32;
		i++;
	}
}*/

// void bubble_sort(int ptr[], int n)
// {
// 	int i, j, temp;
// 	for(i=0;i<n-1;i++)
// 	{
// 		for(j=0;j<n-i-1;j++)
// 		{
// 			if(ptr[j]>ptr[j+1])
// 				{
// 					temp=ptr[j];
// 					ptr[j]=ptr[j+1];
// 					ptr[j+1]=temp;
// 				}

// 		}
// 	}

//  }

// int capital(char ch)
// {
// 	int flag=0;
// 	if(ch>=65&&ch<=90)
// 		flag=1;
// 	return flag;

// }

// int small(char ch)
// {
// 	int flag=0;
// 	if(ch>='a'&&ch<='z')
// 		flag=1;
// 	return flag;

// }
// int prime(int number)
// {
// 	int flag=1, i;
// 	for(i=2;i<=number/2;i++)
// 	{
// 		if(number%i==0)
// 		{
// 			flag=0;
// 			break;
// 		}
// 	}
// 	if(number<=1)
// 		flag=1;
// 	return flag;
// }

#include <stdio.h>

int main()
{
    int n, cnt = 0;
    char str[101];
    scanf("%d %s", &n, str);
    for(int i = 1; str[i]; ++i) {
        if(str[i] != str[i - 1]) {
            str[i] = str[i + 1];
            ++cnt;
        }
    }
    printf("%d\n", n - cnt);
    return 0;
}

#pragma warning(disable:4996)
#include <stdio.h>
#include <malloc.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#define N 100
#define EPS 1E-5
//#define min(a,b) (a>b) ? b : a
int lol(const void *x1, const void *x2)
{
	return *(int*)x1 - *(int*)x2;
}
/*
int gcd(int a, int b)
{
	int c;
	while (b)
	{
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}*/
int Min(int a, int b)
{
	return (a > b) ? b : a;
}
int main(void)
{
	char ch[101], c;
	int n, i = 0, count = 0;
	scanf("%i%c", &n, &c);
	do
	{
		scanf("%c", &c);
		if (c != '\n')
			ch[i++] = c;
	} while (c != '\n');
	ch[i] = c;
	for (i = 0; i<n; i++)
	{
		if (ch[i] == 'U' && ch[i + 1] == 'R' || ch[i] == 'R' && ch[i + 1] == 'U')
			i++;
		count++;
	}
	printf("%i", count);
	return 0;
}

#include <stdio.h>
#include<string.h>
void check_replace(char *s)
 {
     while(*s!='\0')
     {
         if(*s=='U')
         {
             if(*(s+1)=='R')
             {
                *s='D';
                char *p=s+1;
                while(*p!='\0') {*p=*(p+1);p++;}
             }
             else
                s++;
         }
         else if (*s=='R')
         {
             if(*(s+1)=='U')
             {
                 *s='D';
                 char *p=s+1;
                 while(*p!='\0') {*p=*(p+1);p++;}
             }
             else
                s++;
         }
         else
            s++;
     }
 }
int main(void) {

	int n;
	scanf("%d",&n);
	char s[n];
	scanf("%s",s);

	check_replace(s);
	printf("%d",strlen(s));

	return 0;
}

#include<stdio.h>
#include<string.h>
int main() {
	int l;
	scanf("%d",&l);
	char ss[102];
	scanf("%s",ss);
	int b;
	b = strlen(ss);
	int a = 1;
	for(int i = 0; i < b - 1; i++) {
		if(ss[i] == 'R' && ss[i + 1] =='U') {
			i++;
		}
		else if(ss[i] == 'U' && ss[i + 1] == 'R') {
			i++;
		}
		a++;
	}
	printf("%d\n",a);

	return 0;

}

#include <stdio.h>

int main(){
    int i,n,hasilD = 0,hasil = 0;
    scanf("%d",&n);
    char arr[n];
    scanf("%s",&arr);

    for(i = 0 ;i<n-1;i++){
        printf("I SEKARANG : %d\n",i);
        if(arr[i] != arr[i+1]){
            hasilD++;
            i++;
        }

        }
    printf("%d",n-hasilD);
    return 0;
}

#include<stdio.h>
int main()
{
	int n,i,j,k=0;
	scanf("%d",&n);
	char a[n];
	fflush(stdin);
	for(i=0;i<n;i++)
	{
		scanf("%c",&a[i]);
	}j=0;
while(j<n-1)
	{
		if(a[j]!=a[j+1])
		{
			k++;
			j++;

		}
		j++;
	}
	printf("%d",n-k);
	return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
    int n,i,l,s=0,c=0;
    scanf("%d",&n);
    char str[n];
    scanf("%s",str);
    l=strlen(str);
    //printf("%d %d",n,l);
    for(i=0;i<l;i++)
    {
        if(str[i]!=str[i+1])
        {
            c++;
        }
    }
    if(c%2!=0)
    {
        c=(c/2)+1;
    }
    else if(c%2==0)
    {
        c=c/2;
    }
    printf("%d",n-c);
    return 0;
}

#include<stdio.h>
int main()
{
    int i,n,sum=0;
    char a[110];
    scanf("%d",&n);
    for(i=0;i<n-1;i++)
    {
        scanf("%c",&a[i]);
    }
    for(i=0;i<n-1;i++)
    {
        if(a[i]!=a[i+1])
        {
            sum=sum+1;
            i++;
        }
    }
    printf("%d",n-sum);
    return 0;
}

#include<stdio.h>
int main()
{
    int n,i,count=0,cout,out,result;
    scanf("%d",&n);
    char s[n];
    scanf("%s",&s);
    for(i=0;i<n;i=i+2)
    {
        if(s[i]=='r'&& s[i+1]=='u')
        {
            count++;
        }
        else if(s[i]=='u'&& s[i+1]=='r')
        {
            count++;
        }}

        /*if(s[i]=='u'&& s[i+1]=='r' && s[i+2]=='u')
        {
            count--;
        }*/

    cout=count*2;
    result=n-cout;
    out=result+count;
    printf("%d",out);
    return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
    char a[100];
    int i,l,p=0;

  gets(a);

     for(i=0;i<strlen(a);)
    { if(a[i]!=a[i+1])
    {
        i=i+2;
         p++;
    }

        else if(a[i]=='U'||a[i]=='R')
        {
            p++;
            i++;
        }

    }

    printf("%d",p);
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
int main()
{

    unsigned char n , i=0;
    char *s;
    scanf("%d",&n);
    s=(char*)malloc(sizeof(char)*n);
    scanf("%s",s);
    int nbre = n;
    while(i<n-1)
    {
        if((s[i]=='U'&&s[i+1],'R')||(s[i]=='R'&&s[i+1]=='U'))
        {
            i+=2;
            nbre--;
        }
        else i++;
    }
    printf("%d",nbre);
}

#include<stdio.h>
int main()
{
    int n,i,count=0;
    scanf("%d",&n);
    char s[n+1];
    scanf("%s",&s);
    for(i=0;i<n;i=i+1)
    {
        if(s[i]=='U')
        {
            if(s[i+1]=='R')
            {
                count=count+1;
                i=i+2;
            }
            else
            {
                i=i+1;
            }
        }
        else if(s[i]=='R')
        {
            if(s[i+1]=='U')
            {
                count=count+1;
                i=i+2;
            }
            else
            {
                i=i+1;
            }
        }
    }
    printf("%d",n-count);
}

#include <stdio.h>
#include <string.h>

int main()
{
	int n,i,j ;
	char ch[100], ch1[100]="";
	do {scanf("%d",&n);} while((n<1)||(n>100));
	int b = 0 ;
	do
	{i=0 ;
	scanf("%s",ch);
		while(i<strlen(ch))
			if ((ch[i] == 'U') || (ch[i] == 'R')) {i++; b=1; } else {b=0; break ;}
	} while((b==0) || (strlen(ch) != n)) ;
	i=0 ;
	j=0;

	while(i<n) {
			if(ch[i] != ch[i+1]){strcat(ch1,"D") ; i=i+2; j++;}
			else{ch1[j]=ch[i] ; i++ ;j++;}

	 }
	int k = strlen(ch1);
	printf("%d",k);

return 0 ;
}

#include <stdio.h>

int main() {
    int a;
    scanf("%d",&a);
    int x=a%2;
    printf("%d", x);
}

#include<stdio.h>
#include<string.h>
int main() {
	int l;
	scanf("%d",&l);
	char ss[102];
	for(int i = 0; i < l; i++) {
		scanf("%c", &ss[i]);
	}

	int a = 1;
	for(int i = 0; i < l - 1; i++) {
		if(ss[i] == 'R' && ss[i + 1] =='U') {
			i++;
		}
		else if(ss[i] == 'U' && ss[i + 1] == 'R') {
			i++;
		}
		a++;
	}
	printf("%d\n",a);
	return 0;

}

#include<stdio.h>
#include<conio.h>

int main()
{
   char str[100];
   int len,ctr,count=0;
   scanf("%d",&len);
   scanf("%s",str);
   for( ctr = 0 ; ctr < len; )
   {
       if( str[ctr+1] != NULL )
       {
       if( str[ctr] == 'U'&& str[ctr+1] == 'R')
         {
             count++;
             ctr+=2;
         }
        else if( str[ctr] == 'R' && str[ctr+1]== 'U')
        {
            count++;
            ctr+=2;
        }
        else
        ctr++;
       }
       else
       {
       count++;
       ctr++;
       }
   }

   printf("%d",count);
}

#include <stdio.h>

int main() {
    int n,l=0;
    char m[100];

    scanf("%d",&n);
    scanf("%s",m);

    for(int i=0;i<n-1;i++){
        if(m[i]!=m[i+1])
            l++; i++;
    }

    printf("\n%d",n-l);
}

#include <stdio.h>
#include <stdbool.h>

#define minimum(x,y)((x)<(y) ? (x) : (y))
#define maximum(x,y)((x)>(y) ? (x) : (y))

int main()
{
    int n,i,res;
    bool wait;

    res = 0;
    wait = true;

    scanf("%d",&n);
    char s[n];
    for(i=0;i<n;++i){
        scanf("%c", &s[i]);
        // printf("%c PUTTED\n", s[i]);
        if((!(s[i]==s[i-1]))&&(wait)&&(i>1)){
            // printf("%c c %d\n", s[i],i);
            // printf("%c pc %d\n", s[i-1],i);
            res++;
            wait = false;
        }else{
            wait = true;
        }
    }
    printf("%d",n-res);

    return 0;
}

//
// cout << m-arrSum;

#include <stdio.h>

int main() {
    int a,x;
    scanf("%d",&a);
    x=a%2;
    printf("%d", x);
}

#include<stdio.h>

int main()
{
	int n,moves=0,i;

	scanf("%d", &n);
	char walk[n];

	scanf("%s", walk);

	for(i=0;i<n;){
		printf("i=%d", i);
		if ( (i==(n-1)))
		{
			moves++;
			break;
		}
		if(walk[i]=='U'){
			if(walk[i+1]=='R'){
				moves+=1;
				i=i+2;
			}
			else{
				moves++;
				i++;
			}
		}
		if(walk[i]=='R'){
			if(walk[i+1]=='U'){
				moves+=1;
				i=i+2;
			}
			else{
				moves++;
				i++;
			}
		}
	}

	printf("\n%d", moves);
}

#include<stdio.h>
#include<conio.h>

int main()
{
   char str[100];
   int len,ctr,count=0;
   scanf("%d",&len);
   scanf("%s",str);
   for( ctr = 0 ; ctr < len-1; )
   {
       if( str[ctr+1] != NULL )
       {
       if( str[ctr] == 'U'&& str[ctr+1] == 'R')
         {
             count++;
             ctr+=2;
         }
        else if( str[ctr] == 'R' && str[ctr+1]== 'U')
        {
            count++;
            ctr+=2;
        }
        else
        ctr++;
       }
       else count++;
   }

   printf("%d",count);
}

#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    char s[n+1];
    scanf("%s",s);
    int i=0;
    int e=0;
    for(i=1;i<n;)
    {
        if(s[i]!=s[i-1])
            {
                if(i==n-2)
                    e++;
            i+=2;
            }
        else{
            i++;}
            e++;
    }
    printf("%d",e);
}

#include<stdio.h>
int main()
{
    int i,n,sum=0;
    char a[110];
    scanf("%d",&n);
    for(i=0;i<n-1;i++)
    {
        scanf("%c",&a[i]);
    }
    for(i=0;i<n-1; )
    {
        if(a[i]!=a[i+1])
        {
            sum=sum+1;
            i=i+2;
        }
        else{i++; }

    }
    printf("%d\n",sum);
    printf("%d",n-sum);
    return 0;
}

#include <stdio.h>
#include <string.h>

int main()
{
	int n,i,j ;
	char ch[100], ch1[100];
	do {scanf("%d",&n);} while((n<1)||(n>100));
	int b = 0 ;
	do
	{i=0 ;
	scanf("%s",ch);
		while(i<strlen(ch))
			if ((ch[i] == 'U') || (ch[i] == 'R')) {i++; b=1; } else {b=0; break ;}
	} while((b==0) || (strlen(ch) != n)) ;
	i=0 ;
	j=0;
	while(i<n) {
			if(ch[i] != ch[i+1]){strcat(ch1,"D") ; i=i+2; j++;}
			else{ch1[j]=ch[i] ; i++ ;j++;}

	 }
	int k = strlen(ch1);
	printf("%d",k);

return 0 ;
}

#include<stdio.h>
int main()
{
    int a;
    char b[101];

    scanf("%d",&a);
    scanf("%s",b);

    for(int i=0;i<a-1;i++)
    {
        if(b[i]!=b[i+1])
            a--;

    }

    printf("%d\n",a);
    return 0;

}

#include<stdio.h>
#include<stdlib.h>

int main()
{
  int n;
  scanf("%d",&n);
  char* s=(char*)malloc(sizeof(char)*n);
  int i,c=n;
  for(i=0;i<n;i++)
    scanf(" %c",&s[i]);
  for(i=0;i<n;++i)
  {
    if((s[i]=='R' && s[i+1]=='U')||(s[i]=='U' && s[i+1]=='R'))
    c--;
  }
  printf("%d",c);
  return 0;
}

#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    char s[n+1];
    scanf("%s",s);
    int i=0;
    int e=0;
    for(i=1;i<n;)
    {
        if(s[i]!=s[i-1])
            i+=2;
        else{
            i++;}
            e++;
    }
    printf("%d",e);
}

#include<stdio.h>
#include<string.h>
int main()
{
    int i,j=0,n,count=0;
    char s[101],a[101];
    scanf("%d",&n);
    getchar();
    gets(s);
    for(i=0;i<strlen(s);i++)
    {
        if(s[i]=='U'&&s[i+1]=='R'||s[i]=='R'&&s[i+1]=='U')
        {
              a[j]='D';
              i++;
              j++;
        }
        else
            a[i]=s[i];
    }
    printf("%d",strlen(a));
}

#include <stdio.h>

int main(int argc, char **argv)
{ int n,i,c=0;
	scanf("%d",&n);
	char a[n];
	scanf("%s",a);
	for(i=0;i<n-1;i++){
		if(a[i]!=a[i+1]){
			c=c+1;
			i=i+1;
		}
	}
	printf("%d",c);

	return 0;
}

#include<stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	char data[n];
	scanf("%s",data);
	char prev = data[0];
	int cnt=0;
	for(int i=1;data[i];i++){
		if(data[i]!=prev){
			cnt++;
			i++;
			prev = data[i];
		}
	}
	printf("%d",n-cnt);
	return 0;
}

#include <stdio.h>
#include <string.h>

int main()
{
    int n,i,count=0;
    scanf("%d",&n);
    char s[1005];
    gets(s);
    for(i=0;i<n;i++)
    {
        if((s[i]=='U' && s[i+1]=='R') || (s[i]=='R' && s[i+1]=='U'))
        {
            count++;
            i=i+1;
        }
    }
    printf("%d\n",n-count);
    return 0;
}

#include<stdio.h>
int main(void)
{
char arr[101];
int sum=0, i=0;
scanf("%s", &arr);
while(arr[i]!='\0')
{
if(arr[i]==arr[i+1])
{
sum++;
i++;
}
else
{
sum++;
i+=2;
}
}
printf("%d\n", sum);

return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
    int n, count = 0 , h = 0;
    scanf("%d",&n);
    char stri[100];
    scanf("%s",&stri);
    for(int i = 0; i<strlen(stri)-1; i++)
    {
        if(stri[i]!= stri[i+1])
        {
            count++;
            i++;
        }
        else
            h++;
    }
    printf("%d",count+h+1);
    return 0;

}

#include <stdio.h>

int main(void){
	int maxstep;
	scanf("%d", &maxstep);
	char lalala[101] = {0};
	for(int i = 0; i < maxstep+1; i ++){
		scanf("%c", &lalala[i]);
		printf("%c", lalala[i]);
	}
	int discount = 0;
	for(int i = 1; i < maxstep; i ++){
		if(lalala[i] != lalala[i+1]){
			discount += 1;
			i += 1;
			// printf("%d",i);
		}
	}
	printf("%d", maxstep - discount);
}

#include <stdio.h>
#include <string.h>

int main(){
  int n,i,count=0;
  scanf("%d",&n);
  char a[n];
  scanf("%s",a);
  for(i=1;i<n;i++){
    if(a[i]=='U'&&a[i+1]=='R'||a[i]=='R'&&a[i+1]=='U'){
      i++;
      count++;
    }
  }
  //printf("count=%d\n",count);
  printf("%d",n-count);
  return 0;
}

#include <stdio.h>

int main(){
    int i,n,hasilD = 0,hasil = 0;
    scanf("%d",&n);
    char arr[n];
    scanf("%s",&arr);

    for(i = 0 ;i<n-1;i++){
        printf("I SEKARANG : %d\n",i);
        if(arr[i] != arr[i+1]){
            hasilD++;
            i++;
        }

        }
    printf("%d",n-hasilD);
    return 0;
}

#include <stdio.h>

int main()
{
    int n, cnt = 0;
    char str[101];
    scanf("%d %s", &n, str);
    for(int i = 1; str[i]; ++i) {
        if(str[i] != str[i - 1]) {
            ++cnt;
            ++i;
        }
    }
    printf("%d\n", n - cnt);
    return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
    int i,n,sum=0;
    char a[110];
    scanf("%d",&n);
    scanf("%s",a);

    for(i=0;i<n-1;)
    {
        if(a[i]!=a[i+1])
        {
            sum=sum+1;
            i=i+2;

        }
        i++;

    }
    printf("%d",n-sum);
    return 0;
}

#include<stdio.h>
int main()
{
	int n,i,j,k=0;
	scanf("%d",&n);
	char a[n];
	fflush(stdin);
	for(i=0;i<n;i++)
	{
		scanf("%c",&a[i]);
	}j=0;
while(j<n-1)
	{
		if(a[j]!=a[j+1])
		{
			k++;
			j++;

		}
		j++;
	}
	printf("%d",n-k);
	return 0;
}

#include <stdio.h>
#include <math.h>

int main(){
	char c[105];
	int i,n;
	int count;
	while(~scanf("%d",&n)){
		scanf("%s",&c);
		count=0;
		for(i=0; i<n-1; i++){
			if(abs(c[i]-c[i+1]) == 3){
				i+=2;
				count++;
			}
		}
		printf("%d\n",n-count);
	}
	return 0;
}

#include <stdio.h>
#include <string.h>

char array[128] = {0};

int main(void){
	int n, ans = 0;
	scanf("%d",&n);
	scanf("%s",array);
	puts("haha");
	for(int i=0;i<n-1;i++)
		if(array[i] != array[i+1])
			ans += 1, i++;

	printf("%d\n",n - ans);
	return 0;
}

#include <stdio.h>
#include <string.h>

int main()
{
    int num, count, i;
    char name[101], temp;

    while(scanf("%d %s", &num, &name) == 2){
        count = 1;
        temp = name[0];
        int flag = 0;
        for(i=1; i< strlen(name); i++){
            if((name[i]=='R' && temp == 'U') || (name[i] == 'U' && temp == 'R') && flag == 0){
                temp = name[i];
                flag = 1;
                continue;
            }
            else{
                count++;
                temp = name[i];
                flag = 0;
            }
        }
        printf("%d\n", count);
    }

    return 0;
}

#include <stdio.h>
#include <string.h>

int main()
{
    int n,i,count=0;
    scanf("%d",&n);
    getchar();
    char ch[n+5];
    gets(ch);
    for(i=0;i<n;i++)
    {
        if((ch[i]=='U' && ch[i+1]=='R') || (ch[i]=='R' && ch[i]=='U'))
        {
            count++;
        }
    }
    printf("%d\n",n-count);
    return 0;
}

#include<stdio.h>
int main()
{
    int a;
    char b[101];

    scanf("%d",&a);
    scanf("%s",b);

    for(int i=0;i<a-1;i++)
    {
        if(b[i]!=b[i+1])
            a--;

    }

    printf("%d\n",a);
    return 0;

}

#include<stdio.h>

int main(void)
{
	int num = 0;
	int j = 0;
	int TotalNunmber = 0;

	scanf("%d", &num);
	TotalNunmber = num;
	char abc[100];
	for (int i = 0; i <= num; i++)
	{
		scanf("%c", &abc[i]);
	}

	for (int i = 1; i <= num; i++)
	{
		if (abc[i] == 'R')
		{
			int j = i + 1;
			if (abc[j] == 'U')
			{
				TotalNunmber--;
				int k = j + 1;
				if (abc[k] == 'R')
				{
					TotalNunmber++;
					int u = k + 1;
					if (abc[u] == 'U')
					{
						TotalNunmber--;
					}
				}
			}
		}
		if (abc[i] == 'U')
		{
			int j = i + 1;
			if (abc[j] == 'R')
			{
				TotalNunmber--;
				int k = j + 1;
				if (abc[k] == 'U')
				{
					TotalNunmber++;
				}
			}

		}
	}

	printf("%d", TotalNunmber);

}

#include <stdio.h>

int main(){
    int i,n,hasilD = 0;
    scanf("%d",&n);
    char arr[n];
    scanf("%s",&arr);

    for(i = 0 ;i<n;i++){
        if(arr[i] != arr[i+1]){
            hasilD++;
            i+=2;
        }
    }
    printf("%d",n-hasilD);
    return 0;
}


In the year of 3000 travelling around parallel realities became a routine thing. However one has to take into consideration that travelling like that is highly dangerous as you never know beforehand where you're gonna get...Little Vasya, for instance, found himself in a gaming reality and now he has to successfully complete all levels of a very weird game to get back. The gaming reality is a three-dimensional space where n points are given. The game has m levels and at the beginning of the i-th level the player is positioned at some plane Qi that passes through the origin. On each level Vasya has to use special robots to construct and activate n powerful energy spheres of the equal radius with centers at the given points. The player chooses the radius of the spheres himself. The player has to spend R units of money to construct spheres whose radius equals R (consequently, one can construct spheres whose radius equals zero for free). Besides, once for each level a player can choose any point in space and release a laser ray from there, perpendicular to plane Qi (this action costs nothing). The ray can either be directed towards the plane or from the plane. The spheres that share at least one point with the ray will be immediately activated. The level is considered completed if the player has managed to activate all spheres. Note that the centers of the spheres are the same for all m levels but the spheres do not remain: the player should construct them anew on each new level.Help Vasya find out what minimum sum of money will be enough to complete each level.

The first line contains two integers n and m (1 ≤ n ≤ 900, 1 ≤ m ≤ 100) — the number of energetic spheres and the number of levels in the game correspondingly.  Each of the following n lines contains three integers xi, yi, zi (0 ≤ xi, yi, zi ≤ 104) — the coordinates of the center of the i-th sphere. Assume that these points do not change their positions throughout the game. Then follow m lines, each containing three integers ai, bi, ci (0 ≤ ai, bi, ci ≤ 100, ai2 + bi2 + ci2 > 0). These numbers are the coefficients in the equation of plane Qi (aix + biy + ciz = 0), where the player is positioned at the beginning of the i-th level.

Print m numbers, one per line: the i-th line should contain the minimum sum of money needed to complete the i-th level. The absolute or relative error should not exceed 10 - 6.

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>

#define N	900

long double min(long double a, long double b) { return a < b ? a : b; }
long double max(long double a, long double b) { return a > b ? a : b; }

void srand_() {
	struct timeval tv;

	gettimeofday(&tv, NULL);
	srand(tv.tv_sec ^ tv.tv_usec);
}

int rand_(int n) {
	return (rand() * 76543LL + rand()) % n;
}

long long dot3(int x1, int y1, int z1, int x2, int y2, int z2) {
	return (long long) x1 * x2 + (long long) y1 * y2 + (long long) z1 * z2;
}

long double xx_[N], yy_[N];

int i1, i2, i3; long double x_, y_, r_;

void circle() {
	long double x1 = xx_[i1], y1 = yy_[i1], x2 = xx_[i2], y2 = yy_[i2], x3 = xx_[i3], y3 = yy_[i3];
	long double a, b, c, d, e, f;

	if (x1 == x2 && y1 == y2 || x1 == x3 && y1 == y3 || x2 == x3 && y2 == y3) {
		x_ = (max(max(x1, x2), x3) + min(min(x1, x2), x3)) / 2;
		y_ = (max(max(y1, y2), y3) + min(min(y1, y2), y3)) / 2;
	} else {
		/* (x_ - x1)^2 + (y_ - y1)^2 = (x_ - x2)^2 + (y_ - y2)^2
		 * 2 (x1 - x2) x_ + 2 (y1 - y2) y_ = x1^2 + y1^2 - x2^2 - y2^2 */
		/* (x_ - x1)^2 + (y_ - y1)^2 = (x_ - x3)^2 + (y_ - y3)^2
		 * 2 (x1 - x3) x_ + 2 (y1 - y3) y_ = x1^2 + y1^2 - x3^2 - y3^2 */
		a = (x1 - x2) * 2, b = (y1 - y2) * 2, e = x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2;
		c = (x1 - x3) * 2, d = (y1 - y3) * 2, f = x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3;
		x_ = (e * d - b * f) / (a * d - b * c);
		y_ = (a * f - e * c) / (a * d - b * c);
	}
	r_ = hypotl(x_ - x1, y_ - y1);
}

int ii[N];

void shuffle(int n) {
	int h;

	for (h = 0; h < n; h++) {
		int h_ = rand_(h + 1), tmp;

		tmp = ii[h], ii[h] = ii[h_], ii[h_] = tmp;
	}
}

void mec(int n, int k) {
	int h;

	shuffle(n);
	if (k == 0)
		i1 = i2 = i3 = ii[0];
	circle();
	for (h = k == 0 ? 1 : 0; h < n; h++) {
		int i = ii[h];
		long double x = xx_[i], y = yy_[i];

		if (hypotl(x_ - x, y_ - y) > r_) {
			if (k < 2) {
				if (k == 0)
					i1 = i2 = i3 = i;
				else if (k == 1)
					i2 = i3 = i;
				mec(h, k + 1);
			} else
				i3 = i, circle();
		}
	}
}

int main() {
	static int xx[N], yy[N], zz[N];
	int n, m, i;

	srand_();
	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++)
		scanf("%d%d%d", &xx[i], &yy[i], &zz[i]);
	while (m--) {
		int ux, uy, uz, vx, vy, vz, wx, wy, wz;
		long double vl, wl;

		scanf("%d%d%d", &ux, &uy, &uz);
		if (ux == 0)
			vx = 1, vy = 0, vz = 0;
		else
			vx = -uy, vy = ux, vz = 0;
		wx = uy * vz - vy * uz, wy = -(ux * vz - vx * uz), wz = ux * vy - vx * uy;
		vl = sqrtl(dot3(vx, vy, vz, vx, vy, vz));
		wl = sqrtl(dot3(wx, wy, wz, wx, wy, wz));
		for (i = 0; i < n; i++) {
			int x = xx[i], y = yy[i], z = zz[i];

			xx_[i] = dot3(x, y, z, vx, vy, vz) / vl;
			yy_[i] = dot3(x, y, z, wx, wy, wz) / wl;
		}
		for (i = 0; i < n; i++)
			ii[i] = i;
		mec(n, 0);
		circle();
		printf("%Lf\n", r_);
	}
	return 0;
}

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>

#define N	900

long double min(long double a, long double b) { return a < b ? a : b; }
long double max(long double a, long double b) { return a > b ? a : b; }

void srand_() {
	struct timeval tv;

	gettimeofday(&tv, NULL);
	srand(tv.tv_sec ^ tv.tv_usec);
}

int rand_(int n) {
	return (rand() * 76543LL + rand()) % n;
}

long long dot3(int x1, int y1, int z1, int x2, int y2, int z2) {
	return (long long) x1 * x2 + (long long) y1 * y2 + (long long) z1 * z2;
}

long double xx_[N], yy_[N];

int i1, i2, i3; long double x_, y_, r_;

void circle() {
	long double x1 = xx_[i1], y1 = yy_[i1], x2 = xx_[i2], y2 = yy_[i2], x3 = xx_[i3], y3 = yy_[i3];
	long double a, b, c, d, e, f;

	if (x1 == x2 && y1 == y2 || x1 == x3 && y1 == y3 || x2 == x3 && y2 == y3) {
		x_ = (max(max(x1, x2), x3) + min(min(x1, x2), x3)) / 2;
		y_ = (max(max(y1, y2), y3) + min(min(y1, y2), y3)) / 2;
	} else {
		/* (x_ - x1)^2 + (y_ - y1)^2 = (x_ - x2)^2 + (y_ - y2)^2
		 * 2 (x1 - x2) x_ + 2 (y1 - y2) y_ = x1^2 + y1^2 - x2^2 - y2^2 */
		/* (x_ - x1)^2 + (y_ - y1)^2 = (x_ - x3)^2 + (y_ - y3)^2
		 * 2 (x1 - x3) x_ + 2 (y1 - y3) y_ = x1^2 + y1^2 - x3^2 - y3^2 */
		a = (x1 - x2) * 2, b = (y1 - y2) * 2, e = x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2;
		c = (x1 - x3) * 2, d = (y1 - y3) * 2, f = x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3;
		x_ = (e * d - b * f) / (a * d - b * c);
		y_ = (a * f - e * c) / (a * d - b * c);
	}
	r_ = hypot(x_ - x1, y_ - y1);
}

int ii[N];

void shuffle(int n) {
	int h;

	for (h = 0; h < n; h++) {
		int h_ = rand_(h + 1), tmp;

		tmp = ii[h], ii[h] = ii[h_], ii[h_] = tmp;
	}
}

void mec(int n, int k) {
	int h;

	shuffle(n);
	if (k == 0)
		i1 = i2 = i3 = ii[0];
	circle();
	for (h = k == 0 ? 1 : 0; h < n; h++) {
		int i = ii[h];
		long double x = xx_[i], y = yy_[i];

		if ((x_ - x) * (x_ - x) + (y_ - y) * (y_ - y) > r_ * r_) {
			if (k < 2) {
				if (k == 0)
					i1 = i2 = i3 = i;
				else if (k == 1)
					i2 = i3 = i;
				mec(h, k + 1);
			} else
				i3 = i, circle();
		}
	}
}

int main() {
	static int xx[N], yy[N], zz[N];
	int n, m, i;

	srand_();
	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++)
		scanf("%d%d%d", &xx[i], &yy[i], &zz[i]);
	while (m--) {
		int ux, uy, uz, vx, vy, vz, wx, wy, wz;
		long double vl, wl;

		scanf("%d%d%d", &ux, &uy, &uz);
		if (ux == 0)
			vx = 1, vy = 0, vz = 0;
		else
			vx = -uy, vy = ux, vz = 0;
		wx = uy * vz - vy * uz, wy = -(ux * vz - vx * uz), wz = ux * vy - vx * uy;
		vl = sqrt(dot3(vx, vy, vz, vx, vy, vz));
		wl = sqrt(dot3(wx, wy, wz, wx, wy, wz));
		for (i = 0; i < n; i++) {
			int x = xx[i], y = yy[i], z = zz[i];

			xx_[i] = dot3(x, y, z, vx, vy, vz) / vl;
			yy_[i] = dot3(x, y, z, wx, wy, wz) / wl;
		}
		for (i = 0; i < n; i++)
			ii[i] = i;
		mec(n, 0);
		circle();
		printf("%f\n", r_);
	}
	return 0;
}

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>

#define N	900

double min(double a, double b) { return a < b ? a : b; }
double max(double a, double b) { return a > b ? a : b; }

void srand_() {
	struct timeval tv;

	gettimeofday(&tv, NULL);
	srand(tv.tv_sec ^ tv.tv_usec);
}

int rand_(int n) {
	return (rand() * 76543LL + rand()) % n;
}

long long dot3(int x1, int y1, int z1, int x2, int y2, int z2) {
	return (long long) x1 * x2 + (long long) y1 * y2 + (long long) z1 * z2;
}

double xx_[N], yy_[N];

int i1, i2, i3; double x_, y_, r_;

void circle() {
	double x1 = xx_[i1], y1 = yy_[i1], x2 = xx_[i2], y2 = yy_[i2], x3 = xx_[i3], y3 = yy_[i3];
	double a, b, c, d, e, f;

	if (x1 == x2 && y1 == y2 || x1 == x3 && y1 == y3 || x2 == x3 && y2 == y3) {
		x_ = (max(max(x1, x2), x3) + min(min(x1, x2), x3)) / 2;
		y_ = (max(max(y1, y2), y3) + min(min(y1, y2), y3)) / 2;
	} else {
		/* (x_ - x1)^2 + (y_ - y1)^2 = (x_ - x2)^2 + (y_ - y2)^2
		 * 2 (x1 - x2) x_ + 2 (y1 - y2) y_ = x1^2 + y1^2 - x2^2 - y2^2 */
		/* (x_ - x1)^2 + (y_ - y1)^2 = (x_ - x3)^2 + (y_ - y3)^2
		 * 2 (x1 - x3) x_ + 2 (y1 - y3) y_ = x1^2 + y1^2 - x3^2 - y3^2 */
		a = (x1 - x2) * 2, b = (y1 - y2) * 2, e = x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2;
		c = (x1 - x3) * 2, d = (y1 - y3) * 2, f = x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3;
		x_ = (e * d - b * f) / (a * d - b * c);
		y_ = (a * f - e * c) / (a * d - b * c);
	}
	r_ = hypot(x_ - x1, y_ - y1);
}

int ii[N];

void shuffle(int n) {
	int h;

	for (h = 0; h < n; h++) {
		int h_ = rand_(h + 1), tmp;

		tmp = ii[h], ii[h] = ii[h_], ii[h_] = tmp;
	}
}

void mec(int n, int k) {
	int h;

	shuffle(n);
	if (k == 0)
		i1 = i2 = i3 = ii[0];
	circle();
	for (h = k == 0 ? 1 : 0; h < n; h++) {
		int i = ii[h];
		double x = xx_[i], y = yy_[i];

		if ((x_ - x) * (x_ - x) + (y_ - y) * (y_ - y) > r_ * r_) {
			if (k < 2) {
				if (k == 0)
					i1 = i2 = i3 = i;
				else if (k == 1)
					i2 = i3 = i;
				mec(h, k + 1);
			} else
				i3 = i, circle();
		}
	}
}

int main() {
	static int xx[N], yy[N], zz[N];
	int n, m, i;

	srand_();
	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++)
		scanf("%d%d%d", &xx[i], &yy[i], &zz[i]);
	while (m--) {
		int ux, uy, uz, vx, vy, vz, wx, wy, wz;
		double vl, wl;

		scanf("%d%d%d", &ux, &uy, &uz);
		if (ux == 0)
			vx = 1, vy = 0, vz = 0;
		else
			vx = -uy, vy = ux, vz = 0;
		wx = uy * vz - vy * uz, wy = -(ux * vz - vx * uz), wz = ux * vy - vx * uy;
		vl = sqrt(dot3(vx, vy, vz, vx, vy, vz));
		wl = sqrt(dot3(wx, wy, wz, wx, wy, wz));
		for (i = 0; i < n; i++) {
			int x = xx[i], y = yy[i], z = zz[i];

			xx_[i] = dot3(x, y, z, vx, vy, vz) / vl;
			yy_[i] = dot3(x, y, z, wx, wy, wz) / wl;
		}
		for (i = 0; i < n; i++)
			ii[i] = i;
		mec(n, 0);
		circle();
		printf("%f\n", r_);
	}
	return 0;
}