<gouthampradhan>string_StringCompression_1.java
public int compress(char[] chars) {
    int count = 0;
    int i = 0;
    int p = 0;
    for (int j = 0; j < chars.length; j++) {
      if (chars[i] == chars[j]) {
        count++;
      } else {
        chars[p] = chars[i];
        p++;
        if (count > 1) {
          String countStr = String.valueOf(count);
          for (int l = 0; l < countStr.length(); l++) {
            chars[p++] = countStr.charAt(l);
          }
        }
        i = j;
        count = 1;
      }
    }
    chars[p] = chars[i];
    p++;
    if (count > 1) {
      String countStr = String.valueOf(count);
      for (int l = 0; l < countStr.length(); l++) {
        chars[p++] = countStr.charAt(l);
      }
    }
    return p;
  }
public int sample_funcname ( char [ ] var_0 ) {
  int var_2 = 0 ;
  int var_3 = 0 ;
  int var_4 = 0 ;
  for ( int var_5 = 0 ;
  var_5 < var_0 . length ;
  var_5 ++ ) {
    if ( var_0 [ var_3 ] == var_0 [ var_5 ] ) {
      var_2 ++ ;
    }
    else {
      var_0 [ var_4 ] = var_0 [ var_3 ] ;
      var_4 ++ ;
      if ( var_2 > 1 ) {
        String var_10 = String . valueOf ( var_2 ) ;
        for ( int var_11 = 0 ;
        var_11 < var_10 . length ( ) ;
        var_11 ++ ) {
          var_0 [ var_4 ++ ] = var_10 . charAt ( var_11 ) ;
        }
      }
      var_3 = var_5 ;
      var_2 = 1 ;
    }
  }
  var_0 [ var_4 ] = var_0 [ var_3 ] ;
  var_4 ++ ;
  if ( var_2 > 1 ) {
    String var_10 = String . valueOf ( var_2 ) ;
    for ( int var_11 = 0 ;
    var_11 < var_10 . length ( ) ;
    var_11 ++ ) {
      var_0 [ var_4 ++ ] = var_10 . charAt ( var_11 ) ;
    }
  }
  return var_4 ;
}
